# Copyright (c) 2019 by Tommaso Becca
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

mission "Graveyard Label"
	landing
	invisible
	source
		attributes ka'het
	on offer
		event "graveyard label"
		fail

event "graveyard label"
	galaxy "label graveyard"
		sprite label/graveyard

mission "Disabled Ka'het"
	boarding
	invisible
	source
		government "Ka'het" "Ka'het (Infighting)"
	destination "Earth"
	on offer
		conversation

			branch "boarded aberrant"
				has "Disabled Aberrant: offered"

			action
				log `Successfully boarded a Ka'het. It appears to be a single, ship-sized organism that can travel in space using a special exoskeleton.`

			`Your ship slowly approaches the <origin>, now floating lifeless near you. As you move closer, you spot a massive hole in the hull of the ship, revealing what appears to be a large, slug-like being. While most of the ship's machinery doesn't seem to have received heavy damage, weapons fire must have hit the slug's vital organs, killing it, after which point the ship seems to have stopped working.`
			`	You have no troubles docking with what seems to be its "exoskeleton," trying to decide what to do next. While the Ka'het is too different from a normal ship for you to command it, it's safe to say that you can now loot its outfits.`
				goto end

			label "boarded aberrant"
			action
				log "Successfully boarded a Ka'het. Like the Aberrant, it appears to be a single, ship-sized organism that can travel in space using a special exoskeleton, but does not seem to induce the same ominous feeling."

			`Your ship slowly approaches the <origin>, now floating lifelessly near you. As you move closer, you spot a massive hole in the hull of the ship, revealing what appears to be a large, slug-like being, very similar to what you found inside the Aberrant. While most of the ship's machinery doesn't seem to have received heavy damage, weapons fire must have hit the slug's vital organs, killing it, after which point the ship seems to have stopped working. Unlike with the Aberrant, you feel no strange presence or ominous feelings as you approach - it is merely a dead animal.`
			`	You have no troubles docking with its "exoskeleton," trying to decide what to do next. While the Ka'het is too different from a normal ship for you to command it, it's safe to say that you can now loot its outfits.`

			label end

				decline

conversation "ka'het: remnant"
	`Do you want to ask the Remnant about the section of space south of the Ember Wastes, the Graveyard, and its inhabitants?`
	choice
		`	(Yes.)`
		`	(Not now.)`
			defer
	branch taely
		has "remnant met taely"
	`	You ask around more than a dozen people, but none of them seems to be aware of what you're talking about. Either the information is too confidential to be given to a stranger like you, or you didn't ask the right people.`
		decline
	label taely
	`	You ask around more than a dozen people, but none of them seems to be aware of what you're talking about. Perhaps you might have more luck asking Taely on Viminal.`
		decline

mission "First Contact: Ka'het: Remnant 1A"
	landing
	invisible
	source
		government "Remnant"
		not planet "Viminal"
	to offer
		or
			has "Graveyard Label: offered"
			has "ringworld debris"
			has "Ringworld Debris: Quarg: offered"
		has "remnant: blood test pure"
		not "First Contact: Ka'het: Remnant 1B: offered"
	on offer
		conversation "ka'het: remnant"

mission "First Contact: Ka'het: Remnant 2A"
	landing
	invisible
	source "Viminal"
	to offer
		or
			has "Graveyard Label: offered"
			has "ringworld debris"
			has "Ringworld Debris: Quarg: offered"
		has "remnant: blood test pure"
		not "remnant met taely"
		not "First Contact: Ka'het: Remnant 1B: offered"
	on offer
		conversation "ka'het: remnant"

mission "First Contact: Ka'het: Remnant 1B"
	landing
	invisible
	source "Viminal"
	to offer
		or
			has "Graveyard Label: offered"
			has "ringworld debris"
			has "Ringworld Debris: Quarg: offered"
		has "remnant met taely"
	on offer
		conversation
			`Do you want to ask Taely about the section of space south of the Ember Wastes, the Graveyard, and its inhabitants?`
			choice
				`	(Yes.)`
				`	(Not now.)`
					defer
			`	You find Taely inside one of the outer hangars of the shipyard, apparently teaching a small group of people how to make basic repairs on an Albatross. You sit on a bench waiting for her to finish her lesson, after which she walks over to you. "Hello, <first>!" she says. "Is there something I can help you with?"`
			`	"I'm here because I need to ask you a few questions," you reply.`
			`	As she sits near you, you start explaining to her the area you reached, including the weird alien ships that attacked you with weapons similar to the ones the Remnant possess, although this doesn't seem to be news for her. "We know of the existence of the Ka'het, the aliens you encountered, since we first reached the Ember Wastes. We found many of their shells within our planets, crashed there thousands, perhaps even tens of thousands of years before our arrival, but some of their outfits survived long enough for us to reverse engineer these advanced technologies."`
			`	"Then," she continues, "a few hundred years ago, a scout fleet arrived in a system where some Ka'het were still alive. They attacked our fleet instantly with EMP Torpedoes that quickly disabled two Starlings. The Starlings couldn't recover quickly enough to survive, and the only remaining ship could do nothing but flee as soon as possible."`
			choice
				`	"Which technology did you recover from the crashed Ka'het?"`
					goto tech
				`	"Wait, why did you call them 'shells' and not ships?"`
					goto shells
				`	"Have the Ka'het ever attacked the Remnant planets?"`
			`	"Actually, we never met any living Ka'het in the Ember Waste at all. The shells we found had similar capabilities to the quantum keystone, meaning they could pass through the wormholes, so we don't know for sure why they remained in the Graveyard. Perhaps they aren't aware of their skills, or maybe they lost them over time."`
			choice
				`	"Wait, why did you call them 'shells' and not ships?"`
					goto shells
			label tech
			`	"Back then we found large numbers of their EMP Torpedoes, most of which were in nearly pristine condition; their internal mechanisms were also simple enough that we were able to reproduce them perfectly. We couldn't do the same with the other surviving systems in the shells, but their tech has been a source of inspiration for centuries."`
			choice
				`	"Wait, why did you call them 'shells' and not ships?"`
			label shells
			`	"You see, <first>," she says, "the Ka'het aren't normal spaceships. The debris we found were artificial exoskeletons, built around huge living beings; it's unlikely a species that big could have developed that sort of technology, so we presume someone must have created it for them. We call them the Builders.`
			`	"After we lost the first scout ships in the Graveyard, the prefects decided that we should continue to scout the region but take necessary precautions. Thanks to those protocols, some of which are still applied today, we were able to extensively explore most of the Graveyard and decipher a good amount of the written language we found. There is still much we have yet to discover."`
			`	You discuss the Graveyard with Taely for a while longer until one of the people she was talking to earlier comes closer and shows her something on a data pad. "I have to go now, Captain," she tells you. "Good luck."`
				decline
	on decline
		log `Asked Taely about the Graveyard and the Ka'het and learned of the Remnant's previous contacts between them.`
		log "Factions" "Ka'het" `The Ka'het are a species which live in the Graveyard, an area south of the Ember Waste. They are large lifeforms which can travel in space using artificial exoskeletons and will attack anyone on sight, even other Ka'het.`

mission "graveyard insights compatibility"
	landing
	invisible
	to offer
		has "First Contact: Ka'het: Remnant 1B: offered"
	on offer
		event "graveyard insights"
		fail

event "graveyard insights"
	planet Alix
		add description `	Here the Ka'het attacks were limited to the inhabited settlements; had they also destroyed the mining bases and the unmanned vessels, Parii'het would have run out of supplies thousands of years ago.`
	planet Celeatis
		add description `	This planet appears to have been home to one of the largest Builder research centers, which focused on studying the anomaly in the system. Had they found out how to stabilize it and use it as a wormhole, perhaps their species would have survived and spread to the rest of the Ember Waste.`
	planet Ceilia'sei
		add description `	The main purpose of Ceilia'sei was to act as some sort of anti-missile platform, but when the Ka'het invaded a second time, the station had no way to defend against their deadly Ravager Beams, and the station's defense systems were subsequently lost forever.`
	planet Eavine
		add description `	This moon was also home for the second Ka'het wave, which, same as the first, refused to obey their creators. It had been terraformed to make it a more appealing place to live, but after their civilization collapsed the moon began to return to its natural state. When it reverted to its original sub-zero temperatures, the facilities stopped working, and the Ka'het production in this site came to an end.`
	planet "Letis'sei"
		add description `	As it was designed to be crewed as minimally as possible, only a tiny fraction of Letis'sei station was inhabitable. The rest of the station was instead dedicated to advanced computing and targeting systems, most of which are still intact today.`
	planet Osaeli
		add description `	For most of the intervening millennia between the Builders' achievement of spaceflight and their extinction, Osaeli was the de facto capital of the Builders, a key part of their economy and society. The first Het station was constructed orbiting this planet's star with the purpose of protecting them from any external threat.`
	planet Palarei
		add description `	Thanks to their earlier exploration efforts, this was where the Builders encountered the first lifeforms that evolved outside their home planet. While the climate was drastically different from that of the Builders' homeworld, the fruits the local flora produced were popular enough for Palarei to become a major farming planet.`
	planet Parii'het
		add description `	Parii'het was almost finished when the invasion broke out, and already capable of creating Ka'het. Thanks to the mining on Alix and the occasional asteroid mine operated by the Mar drones, most of the facilities are still fully operational to this day.`
	planet Retilie
		add description `	As it was mainly used for fishing, the settlements on this planet were never as advanced as the ones on nearby worlds, so when the Ka'het arrived, there was basically nothing to stop them: after a few attacks, the planet was uninhabited again.`
	planet Seli'het
		add description `	This was the only Het station the Builders ever completed, orbiting Giribea. As the young Ka'heta reach their "Age of Assembly," strange, lanky machines start molding an exoskeleton onto their bodies right away. As the Ka'heta grow, their exoskeleton is expanded and various outfits are added, transforming them into living weapons.`
	planet Siteria
		add description `	This was the Builder homeworld; both the place where their journey began and where it ended. After a dozen millennia of underpopulation, the Ka'het arrival forced them to withdraw from the planet entirely. As one of the few remaining planets capable of sustaining farming, this was their last stronghold, falling centuries after the invasion begun.`
	planet Veliante
		add description `	Soon after the beginning the invasion, an attack on some sort of advanced nuclear facility started a meltdown; the fallout quickly spread across most of the planet, leaving all Builder settlements uninhabitable.`

mission "Ringworld Debris"
	landing
	invisible
	on enter "Queri"
		set "ringworld debris"
		conversation
			`When you enter this suspiciously empty system, your attention is drawn to your ship's scanners. The proximity detection system is going off, suggesting that something sizable is close to your ship, although whatever it is you can't see it as you look out your cockpit.`
			`	You turn your ship around and open the hatch of your cargo hold, catching the object. When you go to inspect it, you see a small, extremely dark piece of debris that almost looks to be covered in vantablack, but it doesn't resemble any alloy you've seen on a spaceship or station, bearing semblance to both a crystal and a metallic structure.`
			scene "scene/ringworld debris"
			`	In one particular corner you see that there is a small, barely recognizable tube, badly damaged but with a few intact wires creeping out. After tinkering a bit with the wires, you manage to connect the debris to your ship's secondary power systems. It barely uses any energy at all, but you can feel the air around it starting to get slightly colder.`
			`	You unplug it and store the debris in a separate part of your ship. Maybe some alien species could tell you about it, if you were to bring it to them.`
		fail
	to complete
		never

mission "Ringworld Debris: Remnant"
	minor
	landing
	invisible
	source
		government "Remnant"
	to offer
		has "ringworld debris"
		has "First Contact: Ka'het: Remnant 1B: offered"
	on offer
		conversation
			`Do you want to show the Remnant the piece of debris you found in the abandoned, empty system, and ask them what they know about it?`
			choice
				`	(Yes.)`
				`	(Not now.)`
					defer
			`	A group of Remnant researchers quickly come to your ship when you mention you've found an odd piece of technology, but look disappointed and some even frown when they see the debris, as you explain the system you found it and how it reacted to being fed some energy.`
			`	"We've found many fragments like this one drifting in that system over the decades. It could maybe improve our cooling systems, but we could never begin to comprehend how it works," one of them says.`
			`	They say they don't know any more than you do about the object, but ask that you share with them any information on how it works, should you find out.`
				decline

mission "Ringworld Debris: Hai"
	minor
	landing
	invisible
	source
		government "Hai"
	to offer
		has "ringworld debris"
		has "First Contact: Hai: offered"
	on offer
		conversation
			`Do you want to show the Hai the piece of debris you found in the abandoned, empty system, and ask them what they know about it?`
			choice
				`	(Yes.)`
				`	(Not now.)`
					defer
			`	You ask around for a bit, and eventually are lead to a workshop where some Hai engineers and shipwrights are gathered.`
			`	"Greetings, human friend! How may we help you?"`
			`	You show them the piece of debris, and they observe it for a bit, but after just a few minutes of handling it they conclude they don't have the necessary equipment to analyze it.`
			`	"Sorry, whatever it is that you've found, it is too advanced a technology for our systems," they say. You thank them for their time, and head back to your ship.`
				decline

mission "Ringworld Debris: Coalition"
	minor
	landing
	invisible
	source
		government "Coalition" "Heliarch"
	to offer
		has "ringworld debris"
		has "Coalition: First Contact: done"
	on offer
		conversation
			`Do you want to show the members of the Coalition the piece of debris you found in the abandoned, empty system, and ask them what they know about it?`
			choice
				`	(Yes.)`
				`	(Not now.)`
					defer
			`	After asking around, you're directed to a large Heliarch building, where several of them are standing guard, weapons in hand, while others are performing maintenance on a chunk of hull plating. Judging by its size, it may be a warehouse for their weapons and outfits. "Of assistance how may we be, kind visitor?" One of the agents asks.`
			`	You show them the debris, and explain where you've found it. They are shocked when they see it, but don't attempt to perform any tests on it. "A piece of Quarg technology, this is!" they say, asking again for you to explain where exactly you found it, as they make sure to write it all down this time.`
			`	They then say that they have experience with technology they managed to steal from the Quarg during their war, and that the debris is the remnant of a somewhat common component of Quarg equipment. They also note that what you've found has deteriorated much compared to what they have acquired for themselves, and that it most likely can't even reach a fraction of its optimal cooling output.`
			`	You thank them for their time and the explanation, and head back to your ship.`
				decline

mission "Ringworld Debris: Quarg"
	minor
	landing
	invisible
	source
		attributes "human quarg" "hai quarg"
		attributes "ringworld"
	to offer
		has "ringworld debris"
		has "First Contact: Quarg: offered"
	on offer
		conversation
			`Do you want to show the Quarg the piece of debris you found in the abandoned, empty system, and ask them what they know about it?`
			choice
				`	(Yes.)`
				`	(Not now.)`
					defer
			action
				clear "ringworld debris"
				log "Factions" "Builders" `The Builders inhabited the Graveyard millennia ago, but have since become extinct. They developed some sort of weapon, called the "Ka'het," which stopped obeying their orders and rebelled against them.`
				log "Factions" "Ka'het" `According to the Quarg, the Ka'het were initially a weapon created by the Builders, which then rebelled and led them to extinction. Even in the millennia that passed, they are still being produced in the Graveyard.`
			`	Walking down the principal, alien-looking hall, you decide to stop one of the few Quarg you see there. "Hello, human. How may I be of service?" the Quarg says. You show it the piece of debris, and ask what it knows about it. It is momentarily stunned when you show the dark piece of technology, calmly taking it into its own hands after recovering. "A fragment of our ships, is what it is. A remnant of part of our equipment. Thank you for returning it to us."`
			`	You continue by telling it about your travels in the section of the galaxy where you found the debris, and asking what it knows of the place and the hostiles that inhabit it.`
			`	"Ah, you encountered the remains of the Builders. Millennia ago, they were a flourishing and thoughtful empire, but hostile contacts forced them to grow fearful and hawkish. Although they never did attack us, they always refrained from accepting our aid, and attempted to relocate a greater distance from us and our ringworld there, in worlds easier to maintain than ones they were closer to."`
			choice
				`	"Who were these hostile contacts?"`
				`	"What happened to the Builders?"`
					goto ka'het
			`	"Long ago, few ships coming from a foreign species had reached that region of space, using some of the wormholes leading there. They belonged to a young race who foolishly decided to attack the Builders instead of learning from them. Their ships were stronger than any vessel the Builders possessed at the time, but were also few enough in number to be destroyed by the Builders."`
			choice
				`	"What happened after that?"`
			label ka'het
			`	The Quarg stops for a few seconds before continuing, as if it was reflecting on something. "For many millennia they grew, developing brilliant pieces of technology. Then, compelled by their past experiences, they began creating weapons not only to defend themselves, but also to retaliate; these 'Ka'het,' as they named them, turned on their creators shortly after they were complete.`
			`	"For a few more centuries the Builders lasted, before falling under their very own hubris. Their space is still populated by the Ka'het they gave birth to through the immense facilities they assembled, a being that does not yet possess a vast intelligence." The Quarg bows, still holding on to the piece of debris, and seems to be preparing to walk away.`
			choice
				`	"What happened to your ringworld in the Graveyard? Was it in the system I found that thing?"`
				`	(Let the Quarg walk away.)`
					decline
			action
				log "Asked the Quarg about the history of the Graveyard, and have learned about the previous inhabitants of the region, the Builders."
			`	For the briefest moment, you see patches of skin all over the Quarg's body radically shift from the usual gray to red and blue, some spots mixing into purple, and you could have sworn you saw some part of the iris on its eyes "open" very slightly.`
			`	After coming back to normal, it ponders for a second, then says, "It was in that system, and it was lost, millennia after the Builders had perished."`
			`	It doesn't seem too inclined on answering any more questions, and swiftly walks away.`
				decline

mission "Ka'het: Patir Reveal"
	invisible
	landing
	to offer
		has "Remnant: Cognizance 19: done"
	on offer
		event "patir appears" 3
	on enter "Patir"
		dialog
			`As the jumping sequence comes to an end, you find yourself orbiting a small black hole, surrounded by nothing but countless asteroids and debris. Even more interesting is the fact that the asteroid belt appears to be populated by small spaceships, similar in appearance to the Ka'het that infest the nearby systems but at the same time unlike any of the types you had seen before. Perhaps the Remnant can tell you more about this system and its sudden appearance.`
		fail
	to complete
		never

event "patir appears"
	system "Patir"
		remove hidden

mission "Ka'het: Patir Mystery 1"
	minor
	name "Visit <waypoints>"
	description "Bring Taely with you to visit the <waypoints> system before going to <destination>."
	source
		government "Remnant"
	destination "Aventine"
	waypoint "Patir"
	passengers 1
	cargo "Ka'het tracking equipment" 5
	to offer
		has "Ka'het: Patir Reveal: failed"
	on offer
		conversation
			`Do you want to look for Taely to tell her about the new system that appeared in the Graveyard?`
			choice
				`	(Sure.)`
				`	(Not right now.)`
					defer
			
			`	You aren't surprised to find Taely in the local shipyard, overseeing the welding of some kind of unmanned satellite. Though not familiar enough with Remnant technology to understand its function, you identify a large crystal placed near what you presume to be the front of the probe as a Quantum Key Stone, or at least a derivative of it.`
			`	When Taely notices you walking towards her, she waves at you. "<first>! It has been a while. Were you looking for me?"`
			choice
				`	"I have some news. A new black hole suddenly appeared near the Graveyard, the same way Ssil Vida did."`
					goto talk
				`	"What's the purpose of that satellite?"`
			`	"She is a beauty, is she not? The discovery of the star systems beyond Postverta spurred a large request for exploration probes, more than we've had in decades. This one was my own proposal: she is going to make precise LIDAR scans of the four planets most similar to the worlds we found alien settlements on, searching for relics and ancient artifacts! It is unbelievably exciting to see an idea that you came up with become reality right in front of you."`
			`	She pauses to stare at the probe with pride.`
			`	"Funny you mention Postverta," you say. "A new black hole has just appeared near the Graveyard, the same way Ssil Vida did."`
			label talk
			`	You try to explain the system and its inhabitants as best you can. Taely looks intrigued. "Can you show me what your ship recorded of that system?" she asks. After spending a few minutes checking your ship's registers, she appears even more astonished than before. "This is incredible! It opens so many questions. What if it was the Builders who built Ssil Vida? We thought they never left the Graveyard, but this could change everything. And look at the gravitational slipstreams: this system has no hyperlane connections, at least for the moment. We need to know more." She pauses for a second to think. "Come with me, <first>."`
			`	You follow Taely into a large elevator at the other end of the building. After a short trip, you find yourself in a large underground hangar, full of oddly shaped dishes and complex pieces of machinery. "We use these old shelters to store the parts we do not need anymore. Sometimes they are still handy for replacing broken machinery, so instead of disassembling them we keep them here for a few years. And this," she says, pointing at an array of cylindrical objects, "is the reason we are here."`
			choice
				`	"What is that?"`
				`	"A bunch of rods?"`
			`	"It is an old tracking and surveillance device, developed specifically for the Graveyard," she says. "It was supposed to track all Ka'het it could find and make detailed imagery of their actions, in order to find the patterns that they follow or ways to exploit their controls. The mission was a long-term one, so when an urgent project came up, resources were diverted away from it, leaving some sensors unused.`
			`	"My plan is to install some in the <ship> and go to <waypoints> to find out more about the ships there. It needs to be calibrated precisely before use, but luckily for you, I was the person who developed the deployment procedures," she says with a smirk on her face. "Are you ready?"`
			choice
				`	"Let's go!"`
					goto mount
				`	"How did the attempt at tracking the Ka'het go?"`
				`	"Sorry, but I can't help you this time. You're going to have to find somebody else."`
					decline
			`	"Oh, the scanner is working perfectly. But the Ka'het, as far as we could see, seem to follow no patterns but the most basic ones. I guess you could compare them to simple animals, searching for food and fighting each other for their territory. They seem to have some sort of 'imprinting' towards the stations that breed them, but other than that, they have not shown any other particular behavior yet."`
			choice
				`	"Alright, let's mount the scanner!"`
				`	"Sorry, but I can't help you this time. You're going to have to find somebody else."`
					decline
			label mount
			`	Taely replies, "I will gather a team to install the scanning system. We should be done in around an hour." She leaves the warehouse carrying a scanner, leaving you to prepare your ship for the upcoming mission.`
				accept
	
	on enter "Patir"
		conversation
			`When you enter the system, Taely is already sitting at the scanner's control console. She starts counting loudly. "External deployment in three... two... one... trackers out. Initiating startup sequence." She begins typing commands on a keyboard. "This is going to take a while, <first>," she says, without taking her eyes off the screen. "It is not normally a one-person job."`
			choice
				`	"Is there anything I can do to help you?"`
				`	"I'll wait for you to finish in the cockpit."`
					goto wait
			`	"I am afraid there is not. Give me, say, half an hour and I will have the results ready."`
			label wait
			`	Almost an hour passes, but Taely finally responds. "The scan is complete. The system is currently processing all the data it gathered into something usable; there's nothing we can do but wait." She starts staring out of the cockpit windows. "Black holes are such a wonderful phenomenon. They are so mysterious, and each one is peculiar in its own way, this one especially."`
			choice
				`	"Did you find anything new on how this system appeared?"`
					goto how
				`	"Was this one already known to the Remnant?"`
			`	"That is the oddest part; it was not. We knew about the existence of the stars beyond Postverta as they could be observed from our own systems; they just were not reachable with a jump drive. But, from what I can tell from these readings, Patir did not exist until a short time ago.`
			`	"Do you have anything on why this system appeared?" you ask.`
			label how
			`	"I only have theories for now, none of which can be confirmed. People more knowledgeable than me in the subject are examining the phenomenon right now. But look at this," she says, opening a star map on a holographic projector. "This white dot is Postverta, and we are here. When Ssil Vida first appeared, it released a strong burst of ionizing radiation, and when we were able to calculate its velocity, we found it was going much faster than the speed of light. It is gradually slowing down, so it will not go much further, but exactly the same day that the energy burst was supposed to arrive here, Patir appeared! It would be an incredible coincidence if the two events were not connected.`
			`	"We have even less information about how this system disappeared. If I may venture a guess, I would say that the black hole is involved. The Builders never seemed to possess the ability to make a system disappear, and we have seen in the past that some black holes can render any hyperlane they are connected to inaccessible given enough time. Perhaps a young, non-rotating black hole like this one can do even more. There is a part of me that thinks this system could disappear again any moment, but if anything that motivates me to find as much as we can about it in the time we have," she says with a wink.`
			choice
				`	"Wait, are we in danger?"`
				`	"How much will it take to finish processing the data?"`
					goto data
			`	"Oh, I was just letting my imagination fly. There are thousands of other explanations that are as good as mine, none of which include such a tragic ending. But we can ponder more on those explanations on the way back to <planet>."`
				decline
			label data
			`	"It will take some time before the data is completely analyzed. We should return to <planet> before looking it over, as it should be done by then."`
	
	on visit
		dialog "You've arrived at <planet>, but your mission is not complete! Make sure Taely and all the equipment passes through <waypoints>. If they are on an escort, you must wait for it to arrive at <waypoints> before you return to <planet>."
	on complete
		conversation
			`Upon your return to <planet>, Taely immediately begins browsing through several images on her console that were compiled by the sensors.`
			`	"Look at these, <first>. What do you see?" The first image shows a ship like the others you've seen in Patir working on some kind of small structure. In the following pictures, presumably depicting different iterations of the same ship, the structure becomes gradually bigger and more complex until the last one, where a Ka'het-like slug is shown growing inside this shell.`
			`	"The ships, the Fetri'sei, are Von Neumann probes," she says. "Self replicating spacecraft. Unlike the Ka'het, which we found to be unable to reproduce and can only be created in a factory, the Ka'sei can duplicate their own structure with the material harvested from the local asteroids. The process probably takes years, or more, but it is still an incredible achievement."`
			label questions
			choice
				`	"If they can duplicate themselves, why aren't there more Ka'sei?"`
					to display
						not "patir: asked about ka'sei"
					goto kasei
				`	"If the Builders were able to make self replicating spacecrafts, why aren't the Ka'het like that as well?"`
					to display
						not "patir: asked about ka'het"
					goto kahet
				`	"If they were able to get to Patir, does this suggest they have jump drives?"`
					goto jumpdrive
				`	"Why aren't they in other systems?"`
					goto jumpdrive
			label kasei
			action
				set "patir: asked about ka'sei"
			`	"I imagine the problem would be with their lifespan. The Ka'het can survive for a few hundred years once they become operational; these could potentially last for a much shorter time. Another important factor is that we do not know what happened here in the millennia the system was hidden. Perhaps the Ka'sei went into hibernation waiting for the system to appear again."`
				goto questions
			label kahet
			action
				set "patir: asked about ka'het"
			`	Taely looks towards the console again. On the screen a tactical view of the Fetri'sei appears. "Well, consider that the Ka'het are true battleships, heavily shielded and always with their weapons ready. These are more akin to reconnaissance and mining probes. Their structure is extremely weak, and they do not have any weapons except the equipment necessary to mine asteroids. I imagine it would take decades for even just a Maeri'het to replicate itself.`
			`	"There is also the tactical problem: forcing a Ka'het to spend such a long time building copies of itself makes them vulnerable to enemy attacks and unable to effectively fight back, making them ill-suited for the job."`
				goto questions
			label jumpdrive
			`	"They do not have any drives on board, not even a hyperdrive. Limited to sub-light velocity, they would need hundreds of years to pass from one system to another, which is a testament to the Builders' patience. Most species we have encountered abandon any form of sub-light transportation between star systems immediately after developing hyperdrive technology. For all we know, the Ember Waste could have been visited by these Fetri'sei or some other Ka'sei, but they had to leave for some reason we are not aware of. The last Builder died almost 100,000 years ago - so long that having a clear idea of what happened is impossible."`
			choice
				`	"What's the difference between Ka'sei and Fetri'sei?"`
			`	"Well, there is no difference," Taely responds, "not in this case at least. The naming scheme the Builders used is a bit odd: we know that 'Ka,' in their language, has a meaning close to the one of 'group,' 'team,' and sometimes even 'ring,' although it can never be used without a name next to it. So we have 'group mar,' 'group het,' and so on. These are not limited to spaceships: the Ka'het, for example, includes both the biological spacecrafts around the Graveyard and the stations that constructs them, while until now we thought that the Ka'sei included only a handful of large scale construction projects. We know 'Fetri' to be a sort of spaceship sub-classification, but we are not aware of its exact meaning. So the Fetri'sei, or 'ship sei' are a part of the Ka'sei, or 'group sei.' To put it simply, it is similar to how all squares are rectangles, but not all rectangles are squares. It just so happens that everything in this system is classified as a Fetri'sei, so we can use either interchangeably.`
			branch busy
				has "remnant: dusk busy"
			`	"I know someone who will want to see all this. Meet me in the spaceport when you have the chance."`
				decline
			label busy
			action
				set "ka'het: dusk was busy"
			`	"I know someone who will want to see all this. You have met Dusk, correct?"`
			`	You nod. "I have, but I believe he's busy at the moment."`
			`	"That is unfortunate. You should show this to him as soon as he is available," Taely responds. "But I fear I now have to go back to my job now, Captain. I would love to continue the exploration with you, but there are more pressing issues I have to resolve at the moment. I will keep an eye on the activity in Patir, I promise."`

mission "Ka'het: Patir Mystery 2"
	name "Scanners in <system>"
	description "Make detailed scans of the asteroid Dusk indicated in the <system> system."
	source "Aventine"
	destination "Builder Settlement"
	cargo "short range scanner" 15
	blocked "You'll need <capacity> available to carry short range scanners. Return here when you have enough free space."
	to offer
		has "Ka'het: Patir Mystery 1: done"
		not "remnant: dusk busy"
	on offer
		conversation
			branch busy
				has "ka'het: dusk was busy"
			
			branch known
				has "remnant met dusk"
			`You find Taely waiting for you in the spaceport alongside a young Remnant with a touchpad. They both wave as you approach.`
			`	"Captain!" Taely says. "Let me introduce you to Dusk. He is a young researcher who specializes in xenoarchaeology and astrobiology. Dusk, this is <first>, the captain who I told you about earlier. Now I'll leave you two to your work, as I fear I have to go back to my job now. I would love to continue the exploration with you both, but there are more pressing issues I have to resolve at the moment. I will keep an eye on the activity in Patir, I promise. May the embers burn bright for you both."`
			`	As Taely wanders off, you turn to Dusk. "Nice to meet you, Captain!" he says.`
			choice
				`	"Dusk? Are names like that common?"`
				`	"Pleased to meet you too, Dusk."`
					goto greet
			`	"You mean names of the various phases of daylight? Mmm, I would not say they are common, but nor are they rare, either. Our ancestors devoted their lives, one way or another, to studying the stars and the everchanging light of the universe. It should not be surprising that their vocabulary should be so entwined in our culture.`
				goto greet
			
			label known
			`You find Taely waiting for you in the spaceport alongside Dusk. They both wave as you approach.`
			`	"Captain!" Taely says. "I believe you already know Dusk. Dusk, I think you should find this to be right in your area of interest. Now I'll leave you two to your work, as I fear I have to go back to my job now. I would love to continue the exploration with you both, but there are more pressing issues I have to resolve at the moment. I will keep an eye on the activity in Patir, I promise. May the embers burn bright for you both."`
			`	As Taely wanders off, you turn to Dusk. "Nice to see you again, Captain!" he says.`
				goto choice
			
			label busy
			`Dusk is no longer busy. Do you want to contact him about Patir, the black hole system in the Graveyard that appeared out of nowhere?`
			choice
				`	(Sure.)`
				`	(Not right now.)`
					defer
			
			`	You contact Dusk, and he agrees to meet you in the cafeteria. When you spot him, he waves to you. "Nice to meet you again, Captain!" he says.`
			label choice
			choice
				`	"Good to see you too, Dusk."`
					goto greet
				`	"Has Taely told you about what we found?"`
			`	"Yes, a new system has appeared in the Graveyard. How exciting! Taely sent me the data as soon as she could.`
				goto greet
			
			label greet
			`	"I have found something interesting in the data Taely sent me, Captain." Dusk shows you a map of the system Patir with various lines drawn all over it. "This image shows the route followed by every Ka'sei the scanner was able to track. At first sight they do not seem to have much in common, right? However, upon closer examination, there is something consistent about almost every path: once in a while, every ship spends a few minutes on a single asteroid - one of the biggest in the entire asteroid belt.`
			`	"However, this could have easily been just a coincidence; it takes a lot of effort to extract resources from asteroids that size, so maybe they were just combining their forces to harvest it. So, at this point I had an idea." The screen on the touchpad changes, now showing raw numbers separated on a spreadsheet. "The sensors you carried to Patir had various functions, one of which was a high power asteroid scanner. The asteroid in particular was shown to be extremely rich in a particular metal, iridium. There is more iridium in it than the whole of half a dozen Ember Waste systems, planets included. However, here is the odd part: the concentration of iridium on the asteroid when you jumped away was not lower than when the scanning begun, it was higher! For whatever reason, the Fetri'sei are depositing iridium on the asteroid."`
			choice
				`	"Are you sure that it isn't just an error in the measurement?"`
				`	"Why are they doing that?"`
					goto why
			`	"Well, it is a possibility; this instrumentation has not been tested in years. But if it is not, this could give us a lot of insight on the real purpose of these Ka'sei and why they are around that black hole. It is at least worth studying!`
				goto end
			label why
			`	"That is what we are going to find out together! The only way we can find insights on their real purpose is to study this asteroid and what the Ka'sei are doing there.`
			label end
			`	"The plan is to take a short range high power scanner and map the entire asteroid to analyze the site where the Ka'sei are bringing the iridium. After you have made extensive scans of the sites I indicate to you, reach me back here on <origin> so that I can analyze the data. If everything goes well, you should be back here in a couple weeks. Now I have already directed the spaceport engineers to install the scanners on your ship. I almost can't wait to see what you find there!" Dusk is so excited that he leaves before you can respond.`
				accept
	on accept
		"remnant met dusk" ++
		set "remnant: dusk busy"
		event "asteroid on patir"
	on enter "Patir"
		dialog
			`After a brief scan of the system, your ship's computers identify the asteroid that Dusk talked about. Compared to the asteroids you are used to, this one is orders of magnitude bigger, almost the size of a small moon. Land on <planet> in order to get close enough for the short range scanner to analyze it.`
	on visit
		dialog "You've arrived, but you realize your escort carrying the <commodity> has not yet entered the system! Better depart and wait for it."

event "asteroid on patir"
	planet "Builder Settlement"
		remove attributes "requires: ka'sei"

mission "Ka'het: Patir Mystery 3"
	landing
	name "Return to <planet>"
	description "Return to <destination> to show the results of your scans of the large asteroid in Patir to Dusk."
	source "Builder Settlement"
	destination "Aventine"
	cargo "short range scanner" 15
	to offer
		has "Ka'het: Patir Mystery 2: done"
	on offer
		conversation
			`Your initial scans suggest that the asteroid is slowly rotating like a moon or planet. You set your ship on a polar orbit around it and activate the sensors that Dusk gave you, hopefully to find some answers to all the questions raised by Patir's mysterious appearance.`
			`	You start your exploration from the dark side of the asteroid, and from the little you can see, its surface appears to be completely covered in regolith of little importance. But soon after passing the terminator, you see an extremely reflective patch near the horizon. As you get closer, it becomes clear that this is the storage of iridium that Dusk was talking about: an enormous solidified lake of the reflective metal extending for kilometers in every direction inside a gigantic hole the Ka'sei have dug in the terrain.`
			`	In a few hours, you are able to check every site you were told to scan, but most of the surface still remains an unknown.`
			choice
				`	(Continue my exploration of the asteroid.)`
					goto explore
				`	(Leave and return to Aventine.)`
			`	As you are preparing to jump away, an artificial structure near the edge of the iridium storage catches your eye, and you decide to bring your ship in closer.`
				goto image
			label explore
			`	While you are setting up a new route to pass above as much terrain as possible, your eye is caught by an artificial structure near the edge of the iridium storage.`
			label image
			scene "scene/asteroid scene"
			`	The first thing you notice is an array of extremely tall pylons arranged into two parallel lines. When you approach to get a better angle, you discover a large cupola towering over the area. Although understanding its scale without a reference point is hard, you estimate it must be at least a kilometer in diameter.`
			`	You wonder if you should get closer, but the Ka'sei may not take kindly to you approaching their structure.`
			choice
				`	(Collect measurements at a safe distance.)`
				`	(Go near the structure, regardless of the risk.)`
					goto near
			`	The data that Dusk's scanners will gather will not be perfect, but it is better than having to risk getting close to something you know so little about. After a few minutes, the scan completes, and you are ready to return to <planet>.`
				accept
			label near
			action
				"exploration interest" ++
			`	You carefully position your ship above the structure and activate the sensors. As the scan proceeds, you monitor the position of the Ka'sei fleet. Some of the Fetri'sei nearest to you have stopped their standard activities and are standing by, perhaps observing your actions the same way you are observing theirs. Luckily, after a few minutes the sensors complete their analysis of the structure and you are ready to return to <planet> unmolested.`
				accept
	on visit
		dialog "You've returned to <planet>, but you realize your escort carrying the <commodity> has not yet entered the system! Better depart and wait for it."
	on complete
		dialog
			`Near the landing area, you discuss with Dusk what you have found next to the iridium storage. "This is fantastic! It is so much more than I hoped to find with this expedition. Give me a few hours to analyze the data and meet me in the spaceport."`

mission "Ka'het: Patir Mystery 4"
	name "Visit the asteroid"
	description "Bring Dusk to <system> to visit the ancient Builder settlement."
	source "Aventine"
	destination "Builder Settlement"
	passengers 1
	blocked "You'll need <capacity> available so Dusk can join you on your mission. Return with the available space to continue."
	to offer
		has "Ka'het: Patir Mystery 3: done"
	on offer
		conversation
			`You meet Dusk again in the cafeteria with his touchpad, as usual. "Thank you again for your help, <first>. There is a lot we can learn about the Builders with this discovery." He shows you a black and white image of a building inside a hemispherical dome. The complex appears to be made of interconnected cylinders, presumably habitation modules.`
			choice
				`	"What is that?"`
			`	"Oh, it is the scan you made of the Builder structure. Here, look: the external cupola is completely pressurized, which could give us insights about the biology of the Builders. The composition of the atmosphere on their planets is likely to have changed after so much time, and every manned station the Ka'het could reach was long destroyed. This is the first time we have the possibility to study the gases they could breathe without having the results compromised by millennia of biological activity. Inside the cupola there is also a large intact complex, which could give us more answers about all of this.`
			`	"If you can bring me to the asteroid, I could be able use the controls and enter in the cupola to measure the composition of the atmosphere."`
			choice
				`	"I'm ready to go."`
					accept
				`	"Wait, are you saying that you can read the Builder language?"`
			`	"Very approximately, but yes. We have been studying every piece of written language we could find from their cities, mostly inside sealed containers. It is very hard to understand full phrases or even what they mean at times, but we can reliably translate most of the common words and phrases, which will hopefully be enough for our mission."`
				accept
	on visit
		dialog "You've arrived, but you realize your escort carrying Dusk has not yet entered the system! Better depart and wait for it."

mission "Ka'het: Patir Mystery 5"
	landing
	name "First contact"
	description "After the tumultuous first contact, return to <destination> without hurting any Ka'sei, even if they attack you."
	source "Builder Settlement"
	destination "Aventine"
	passengers 1
	to offer
		has "Ka'het: Patir Mystery 4: done"
	on offer
		"reputation: Ka'sei" = -10
		conversation
			`As you approach the structure, Dusk stops preparing the equipment to observe it from the window. "It is a fascinating structure. I've only seen a small number of Builder buildings, but this looks different from anything I have seen. Perhaps it is more structurally similar to their stations than their outposts given the almost negligible gravity, or they had other asteroid colonies that have been gradually lost over time. It would be worth doing a serious exploration of the asteroid belts in the Graveyard at some point."`
			choice
				`	"You have been on Builder planets?"`
					goto planets
				`	"How far have the Remnant explored the Graveyard?"`
				`	"Do you have all the equipment ready?"`
					goto skip
			
			`	"I presume Taely already told you about the troubled beginnings we had in exploring the area; as a consequence of that, we had to reevaluate the procedures for exploring the nearby systems and species, especially beyond the Ossipago wormhole. Every scout ship entering the area has to always remain cloaked to prevent attacks from the countless Ka'het patrolling the area; this means that the further we need to travel to reach the destination, the more fuel we have to spend to return home, which considerably impacts the time we can spend cloaked in the destination. Some of the systems at the other end of the Graveyard have seen very few Starlings, most of them staying for less than a day.`
			`	"Still, even with these limitations we were able to make considerable progress. We can read some of the words in their language, and we were able to retrieve a countless number of partly intact Builder artifacts. Perhaps some day we will be able to understand how to control the Ka'het. Who knows?`
				goto skip
			
			label planets
			`	"Oh I have, many times. I have never been on a Builder station, but on a few occasions I have participated to expeditions to newly discovered cities or semi-submersed bunkers. I presume Taely already told you about the troubled beginnings we had in exploring the area; as a consequence of that, we had to reevaluate the procedures for exploring the nearby systems and species, especially beyond the Ossipago wormhole. Every scout ship entering the area has to always remain cloaked for safety; this means that exploring planets is only possible for a limited time and that you cannot leave your ship if you do not have a means of hiding yourself from them.`
			`	"Because of this, most of the planetary exploration is done with robotic probes. The Ka'het are able to detect and destroy devices that use faster than light communication, so only remote control with a Starling in the same system is possible. There are a lot of compromises that must be taken, but we can still make considerable progress even with these restrictions.`
			
			label skip
			`	"I need to prepare a few more instruments before we land," Dusk says as he stops staring at the dome and returns to his equipment. As you reach the complex, you do a few flights around it in search for a good landing site. Dusk points out a spot right next to a set of small circular indentations on the structure. After touching down, you and Dusk don extravehicular suits and start walking towards the cupola. He stops in front of a ring on its surface and starts looking through his equipment.`
			choice
				`	"What is that?"`
			`	"Well, I obviously cannot be sure, but given its location and that on the other side there is a pressurized area, it should be an airlock. I have seen scans of the Builder stations, and they look quite similar." He takes a heavy-looking scanner, puts it on the wall of the structure and starts moving it around. "If I am right, this way should have a control station hidden inside the wall - and here it is!" he sings with satisfaction.`
			`	Using a small instrument similar in appearance to a crowbar, Dusk slowly pulls out a section from the wall, kicking off a good amount of dust in the process. The control station is a two-sided panel, full of switches and buttons with small alien markings above each of them.`
			choice
				`	"Can you read them?"`
				`	"Can you open the airlock?"`
					goto open
				`	"Are you sure this won't put us in danger?"`
					goto danger
			`	"I can, yes. The first row of switches controls the lights inside the complex, the second row controls redundant pressurization systems, and there are similar such operations controlled by the rest of the panel.`
				goto open
			label danger
			`	"There is no way to be certain, but this is the only possible way to get in without destroying half of the complex.`
			label open
			`	"This," Dusk says as he presses a switch in the middle of the panel, "is what we were looking for." Soon after, the door in front of you opens, revealing a small room with another door at the opposite end. You follow Dusk inside, where he takes out the scanner again to look for another control panel. Once that is open, another switch allows him to close the door. Only the lights on your helmet keep you from being submerged in complete darkness. Looking around, you notice that the architecture is distinctly alien, with rounded angles on every side of the room and buttresses on either side of the doors. The ring itself is too small for you to pass through it standing upright, but the low gravity of the asteroid lets you almost fly through it without much trouble. "We now have to wait for the room to pressurize," he tells you.`
			choice
				`	"How long do you think it will it take?"`
				`	"Would it be safe to remove our helmets after that?"`
					goto dumb
			`	"I have no idea. Usually it is a matter of a few minutes, but we know next to nothing about this tech. We will have to wait and see. In the meanwhile," he says as he begins to activate another scanner, "I can analyze the atmosphere that is starting to fill this room. It should save us some time to do it here, as well as being safer, should it be dangerous to our suits."`
				goto scan
			label dumb
			`	Dusk gives you an odd look. "Of course not <first>; it would almost certainly kill you. Such an alien atmosphere is unlikely to be breathable for a human, and even if it was we could not be sure until we analyze it extensively." He begins to activate another scanner, "Speaking of which, I can start analyzing the atmosphere that is starting to fill this room. It should save us some time to do it here, as well as also safer, should it be dangerous to our suits."`
			label scan
			`	Dusk continues working on the atmospheric analyzer for about five minutes without anything happening. You try to connect to the scanner on your ship to check the position of the nearby Fetri'sei, but the dome seems to jam all communication with the outside. Suddenly, you hear a loud "pop," and the door that leads inside the dome recesses a few centimeters. "Just in time," Dusk says. "My analysis of the atmosphere has finished. Let us go take a look inside." After a brief look at the writing on the door, he grabs a handle on it and slides it to the left. The hatch starts to slowly open inwards. When you come closer to the entrance you are instantly blinded by a strong light coming from the other side of the door. After lowering the sun shield on your helmet, your eyes start adapting to the new light level, and it takes you a few seconds to realize what is now in front of you. Landed inside the cupola, right in front of the airlock, is a Fetri'sei - a Ka'sei probe - pointed at you and Dusk.`
			`	Both you and Dusk stand still in front of it without saying a word. Out of the corner of your eye, you can see his hands shivering. All of a sudden, the Ka'sei starts emitting a very high pitched sound, very hard to hear, frequently changing in intensity. This lasts only for a few seconds, then abruptly stops.`
			choice
				`	(Run back in the airlock.)`
					goto run
				`	(Stay still and wait.)`
			`	The whole cupola falls silent. What feels like hours pass before the Ka'sei swiftly lifts off in front of you, hovering a few meters above the terrain. Just like the previous time, it starts emitting the same sequence of sounds as the last time, followed by a clicking sound. Dusk turns towards you.`
			choice
				`	(Run back in the airlock.)`
					goto still
				`	(Keep staying still.)`
					goto still
				`	(Try shooting at the hover engines of the Ka'sei with my sidearm.)`
			`	You take out your gun and start aiming for the Fetri'sei's side pods. Your first shot misses it completely, but after that you are able to make three full hits on the hover engines. Almost instantly, the Ka'sei starts emitting a loud siren. The ship fires a beam just to the left of you, letting out an ear-piercing wail. Both you and Dusk jump back to the airlock as fast as possible, but you are too far away to reach it in time before a Ravager beam tears through your suit. The last thing you see is Dusk closing the airlock.`
				die
			
			label still
			`	After another short silence, the Ka'sei starts emitting a loud siren. You hear the screech of Ravager fire as an angry energy beam sears through the air to your left, just barely missing you. Both you and Dusk jump back to the airlock, slamming the door closed. You can still feel the crackle of the Ravager cannons from the other side the door, and after a second, the door begins to glow.`
			choice
				`	(Open the exit door, even with the airlock full of air.)`
					goto blast
				`	(Wait for the airlock to empty.)`
			`	After waiting a few seconds, Dusk hurries towards the control station. "Hold on to something, I ha-" Suddenly, he is interrupted by a burst of light coming from where the door of the airlock used to be. Your suit provides little protection from the full force of the Ravager beams.`
				die
			
			label blast
			`	You reach the control station as fast as you can and press the switch that Dusk had used when you first came in. The blast is not as strong as you imagined, but in a few seconds you are thrown out of the airlock by the sheer force of the air leaving from the breach. Both of you touch down after a few meters, crashing hard in the terrain that surrounds the cupola. Out of the corner of your eye, you see that there's still air coming out of the airlock, signifying that the interior door has been breached. It is very lucky that your suit has not been punctured.`
			`	Looking around, you see Dusk laying face down next to you. Thankfully, he begins to stand up as you approach him. When he sees you, he silently pauses for a moment, before jerking his head to the airlock and signing. "We need to run. It could get out of the cupola, or others could arrive, and here in the open we are even easier targets." You nod and start going with him back to your ship.`
			`	Running at full speed, it takes the two of you only a few minutes to reach the <ship>. Once safely in the cockpit, you sit down to catch your breath. After a moment, Dusk begins searching nervously for something on his suit. He takes out the atmospheric scanner he used earlier, but the screen is cracked and the external sensors are bent. "It must have been destroyed when we fell on the ground. I hope that at least its memory is still intact."`
				goto attack
			
			label run
			`	You start running towards the airlock as fast as you can. Initially, Dusk tries to resist, but you drag him by force and lock the door behind you. Everything falls into silence again for half a minute while you are waiting for the room to depressurize, but suddenly the sound of a Ravager cannon cuts through the silence, and the inner airlock door begins to glow as it takes fire.`
			choice
				`	(Open the exit door, even with the airlock full of air.)`
					goto rush
				`	(Wait for the airlock to empty.)`
			`	After a few seconds of waiting, Dusk hurries towards the control station. "I have an idea," he says as he presses a few switches on the panel. "I can open a vent to expel the air out of here into the void, and get us out of here in a few seconds."`
				goto expel
			label rush
			`	You reach the control station as fast as you can and tell Dusk to hold on to something, but he stops you. "I have a better idea," he says as he presses a few switches on the panel. "I can open a vent to expel the air out of here into the void, and get us out of here in a few seconds."`
			label expel
			`	Soon after, the frontal door recedes. You two run out of the airlock as fast as possible. Behind you, you hear the roar of metal melting as a rush of air passes you by. You start running back to your ship with Dusk, hoping that the Ka'sei will not get out of the building before you are safe.`
			`	Running at full speed, it takes the two of you only a few minutes to reach the <ship>. Once safely in the cockpit, you sit down to catch your breath. After a moment, Dusk begins searching nervously for something on his suit. He takes out the atmospheric scanner he used earlier and turns it on. "Phew. I was afraid it had broken down when we had to run away, but maybe we can still get the data we need."`
			action
				set "atmospheric scan intact"
			
			label attack
			`	Dusk is interrupted by the shrieking wail of your ship's proximity alert as a hostile object appears on the radar screen. As Dusk suspected, the Fetri'sei must have tracked your movements after leaving the cupola. You start to ready your ship for combat, but Dusk interrupts you. "You cannot kill them, <first>. Do you remember the high pitched sound it emitted before shooting? He was trying to speak with us, Captain. Only a few words, maybe even pre-programmed for this kind of interaction, but still a complete phrase or more in pure Builder language. In decades of xenoarchaeological research, this is the first time that it occurs. These ships are an incredible discovery. They may be the only thing still capable of speaking that language in the entire Graveyard. You cannot destroy it, and disabling one is more a matter of luck than skill."`
			choice
				`	"What should I do then?"`
			`	"Well, I can only suggest to depart from here and set a route straight back to Aventine, while avoiding the Ka'sei. Sorry <first>, but it is preferable that we leave them alone." After all the risk you had to take, you cannot help but nod if this means getting as far from here as possible.`
				launch
	
	npc
		government "Ka'sei"
		personality plunders mining harvests staying
		fleet
			names "ka'sei"
			cargo 3
			variant
				"Fetri'sei" 18
				"Fetri'sei (Disable-able)" 6
	
	on enter "Patir"
		dialog
			`Soon after departing, your ship warns you that a large number of ships are targeting you. It appears the other Ka'sei are also going to attack.`
	on visit
		dialog "You've returned to <planet>, but you realize your escort carrying Dusk has not yet entered the system! Better depart and wait for it."
	on complete
		clear "remnant: dusk busy"
		event "patir mystery timer" 10 16
		conversation
			branch attacked
				"reputation: Ka'sei" < -10
			action
				"reputation: Ka'sei" = 1
			`You disembark from your ship with Dusk, discussing the events that occurred in Patir. "Thank you for keeping the Ka'sei alive, <first>. They might be exactly what our Builder research needs, and I really hope I can continue exploring that place with you in the future. I will study what we have gathered in the last days trying to find anything that could give us more clues about them." He waves at you and starts walking towards the exit from the spaceport. "I will contact you again when I find something worth looking at. May the Embers burn bright for you, <first>."`
				decline
			
			label attacked
			action
				set "ka'het: attacked ka'sei"
			`You disembark from your ship with Dusk, who is visible angry that you destroyed one of the Ka'sei. "I told you not to attack them! I told you of their importance!" he signs harshly while pacing back and forth. "Oh my, oh my, we can only hope that this does not close any doors for us. Perhaps we can attempt to communicate with them? Tell them it was an accident?" He looks to you as if searching for some reassurance, but you have none to give. "Forget it. I will study what we have gathered, but I am afraid that it will be all that we will ever gather from that system." Dusk storms off without saying goodbye, typing away on his touchpad as he goes.`

event "pacified ka'sei"
	"reputation: Ka'sei" = 1

event "patir mystery timer"

ship "Cloak Check"
	attributes
		"heat dissipation" 1
		"hull" 3
		"mass" 100
		"drag" 5
		"automaton" 1
		"thrust" 100
		"turn" 6000
	outfits
		"Cloak Checker"
	turret 0 0

outfit "Cloak Checker"
	category "Turrets"
	thumbnail "outfit/unknown"
	"turret mounts" -1
	weapon
		"velocity" 10
		"lifetime" 1
		"reload" 1
		"blast radius" 20
		"hull damage" 5
		"no damage scaling"
		"range override" 1000000
		"turret turn" 360

mission "Ka'het: Patir Mystery 6"
	name "Second contact"
	description "Return to <system> with Dusk and four other xenoarchaeologists to continue your exploration of the <planet>. You will need to be cloaked as you enter to avoid alerting the Ka'sei."
	source
		government "Remnant"
		attributes "remnant primary"
	destination "Builder Settlement"
	passengers 5
	cargo "instruments and samplers" 2
	blocked `As soon as you arrive, Dusk contacts you again. "Welcome back, <first>! We should be ready for the next Patir expedition, but we need at least five free bunks to attempt it, and at least 2 tons of cargo space for samples."`
	to offer
		has "event: patir mystery timer"
		has "Remnant: Cognizance 38: done"
		not "ka'het: attacked ka'sei"
		not "remnant: dusk busy"
	on offer
		conversation
			`It doesn't take long for you to be noticed in the crowded, yet quiet, starport of <origin>. You feel a tap on your shoulder and turn around to see Dusk, accompanied by a group of four. "Good to see you here again, <first>! Do you remember our exploration of the Patir black hole?"`
			branch "atmospheric data"
				has "atmospheric scan intact"
			`	One of the other Remnant shows you a hologram of the system, with what looks like the Builder settlement you visited earlier highlighted by a yellow glow. "After studying the data we gathered during our last visit, we may have devised a way to enter the structure undisturbed! Based on our recordings, the Fetri'sei that attacked us in the structure was gathering materials from the asteroid belt with its fellow Ka'sei, and only moved inside the dome when it spotted us."`
				goto proposal

			label "atmospheric data"
			action
				payment 300000
			`	One of the other Remnant shows you a hologram of the system, with what looks like the Builder settlement you visited earlier highlighted by a yellow light. "First of all, we have transferred <payment> to your logistics account for saving the data on the dome's atmosphere. It is only thanks to you that we were able to learn more about what kind of atmosphere the Builders may have lived in."`
			choice
				`	"Thank you."`
					goto skipdialog
				`	"Can you tell me more about that?"`
			`	"The air in the settlement we visited was almost evenly split between oxygen and argon, while containing very little nitrogen. Despite its differences, it is interesting to note that such a composition is breathable by human standards."`
			`	"We could have removed our helmets after the airlock?" you ask.`
			`	"It is a bit more complicated than that. We found that the pressure inside the complex was much, much lower than what we are used to - less than a sixteenth of an atmosphere. On most Earth-like planets, you would only find such pressures at over 20,000 meters. There are two possibilities: either the Builders were born in a thin atmosphere, or the life support system failed some time ago and the structure has been slowly losing air ever since. We hope to find the answer soon enough.`

			label skipdialog
			`	"On top of that, we have learned that the Fetri'sei that attacked us was not waiting in the structure when we first entered the system; it was gathering materials from the asteroid belt together with the rest of its fellow Ka'sei, and only moved inside the dome when it spotted us."`

			label proposal
			choice
				`	"What are you suggesting?"`
				`	"And?"`
			`	"Cloaking is the key. If we can stay hidden as we enter Patir and land, then the Fetri'sei should stay outside of the settlement, letting us explore further. Make sure your ship has enough fuel for the journey, however; if you drop your cloak at any time in Patir, then the Ka'sei will block our progress again."`
			`	After he finishes signing, he makes a few quick gestures toward the projector, enlarging the hologram of the Builder settlement and revealing what looks like a flight path. "You are going to land roughly where we did last time, carrying me and four other xenoarcheologists. If you accept, I should be able to allocate 100,000 credits to help you buy the necessary equipment for this mission."`
			choice
				`	"I'm in."`
					accept
				`	"What if they detect us while inside the structure?"`
				`	"Sorry, but I don't think it is a good idea to return there."`
					decline
			`	"It is a possibility, yes. It is also quite problematic because communication between the inside and the outside of the structure is impossible. I think the best course of action would be to place a scanner that keeps an eye on the large airlocks on the upper side of the dome, the ones the Ka'sei used last time. If I am right, it should give us around a quarter of an hour to get back in the airlock and escape."`
			choice
				`	"Alright, let's do it."`
					accept
				`	"Sorry, but I don't think it is a good idea to return there."`
					decline

	on accept
		payment 100000
		set "remnant: dusk busy"
	on abort
		clear "remnant: dusk busy"
	on fail
		clear "remnant: dusk busy"
		dialog
			`You have approached the Builder Settlement uncloaked, making the Ka'sei follow you, or the escort that was carrying the Remnant scientists has been destroyed, or the escort that was carrying the mission cargo was destroyed. You have failed this mission.`
	on visit
		dialog `You have reached <planet>, but not all of the cargo and passengers are in the system! Better depart and wait for your escorts to arrive in this star system. Remember that your escorts need to be cloaked as well. You may want to park your escorts that are incapable of cloaking.`
	npc save
		government "Test Dummy"
		personality heroic nemesis unconstrained
		system "Patir"
		fleet
			variant
				"Cloak Check" 10

mission "Ka'het: Patir Mystery 7"
	landing
	name "Return to <planet>"
	description "Take Dusk and the other researchers, as well as <cargo>, back to <destination>."
	source "Builder Settlement"
	destination "Aventine"
	passengers 5
	cargo "Patir samples" 2
	to offer
		has "Ka'het: Patir Mystery 6: done"
	on offer
		conversation
			`As you slowly descend toward the surface of the planetoid, most of the Fetri'sei continue to orbit Patir, going in and out of the asteroid belt to mine precious metals from it. The few around the planetoid travel not towards the ruins of the Builder settlement, but rather to the massive stockpile of iridium situated nearby. After a final pass around the dome to ensure none of them have begun following you, you land near the imprint your spaceship left in the dusty regolith the last time you came here.`
			`	"Great work, Captain. We are ready to start our mission." Dusk and his team are carrying with them a set of instruments similar to the first time you were here, from compact laser scanners to a pair of large crowbars. On the crew's backs are cylinders of varying dimensions, with the largest being almost a meter wide. You follow them through the ship's airlock onto the surface and begin the walk towards the complex. Halfway to the dome, Dusk speaks over the radio. "<first>, before we arrive there, do you have any further questions on the mission plan?"`
			choice
				`	"What should I do once we are inside?"`
					goto inside
				`	"What are you and your team going to do in the complex?"`
					goto dusk
				`	"Do you think the Ka'sei are going to leave us alone the entire time?"`
					goto kasei
				`	"Don't worry, I'll figure it out."`
			`	"Well, I really hope so!" Dusk replies, grinning behind the glass of his helmet.`
				goto entrance

			label inside
			`	"Well, that is up to you. From the brief scans I made of the structure it does not seem to have particularly thick internal walls, so communication between us within the dome should be feasible. You could come with me inside the structure to help identify what we find, or if you prefer you could also remain near the airlocks and keep an eye out for incoming Fetri'sei. As I said, the choice is yours."`
				goto entrance

			label dusk
			`	"It depends. Here, look," he says, passing you a data pad with a rather blurry picture. "It is a still image taken from the recording of our encounter with the Fetri'sei. The strong lights ruined most of the video, so we will to have to settle for this picture, but look at the background: do you see that curved board on the left? The quality of the video is too low to be sure, but I think it could be a map of the complex. If I am right, we could split into groups and cover more ground in the few hours we are going to spend here."`
				goto entrance

			label kasei
			`	"Honestly? At this point, I am positive they will. The last time we came here, they had already found us and were probably starting to enter the dome. Right now, they are still in the asteroid belt continuing their mission. There's the possibility that the airlock will alert them of our arrival, but at this point it is unlikely. In either case, I will be sure to keep an eye on the airlock once we are inside the dome."`
			label entrance
			`	It doesn't take long to reach the airlock ring in front of the dome. The airlock you used last time is still open, and its control panel is visible next to it. Dusk, following your gaze, quickly stops you. "I doubt it would be a good idea to pass through the same airlock we used last time, <first>," he says. "It looks like the structure's automated systems patched up the hole left by the Ka'sei, but I would never trust it as a pressure vessel at this point. Plus, I count at least six more airlocks we could use."`
			`	He and another member of the group move to the opposite side of the control station next to the airlock, then flip one of the switches on the panel. Just like last time, a door opens next to them, revealing another on the opposite side of the small room. There is space only for three crew members at a time; you, Dusk, and another Remnant enter the airlock, while the other three wait their turn. The door closes, and Dusk flips the switch to begin the pressurization procedure. Suddenly, the lights inside the module turn on, emitting a bright, azure light.`
			choice
				`	"Did you do that?"`
				`	"What happened?"`
			`	"I am not sure. Wait." Moving to the opposite side of the airlock, he uses a crowbar to open another hidden control station, which slides out of the wall to reveal a rather large screen scrolling through some alien writing. After reading through it with some difficulty, Dusk breathes a sigh of relief and pulls it back to its original location. "I think it is nothing," he adds, "at least I hope so. From what I could gather, the lights being switched on were a normal, timed event in the commanded startup sequence - why they they did not turn on last time is beyond me, but nothing seems to be out of the ordinary. Perhaps they were just broken."`
			`	A few minutes later, pressurization finishes, and the interior door opens. You follow Dusk out of the airlock and find yourself in front of a large area, likely the same place the encounter with the Fetri'sei took place. "The moment of truth," exclaims Dusk, placing down a heavy scanner, similar to a short telescope. "This is a low-power laser system, capable of measuring the density of the atmosphere anywhere within 10 kilometers. If a Fetri'sei was alerted when we crossed the airlock, by now the large airlock will be filling up with oxygen and argon to allow it to pass through, and this sensor here will register it. Let's see." A tense silence ensues as the machine boots up.`
			choice
				`	"What does it say?"`
				`	"What are the readings?"`
			`	Dusk smiles. "The airlock is still empty. It looks like we can finally begin exploring the facility." When the rest of the group finishes crossing the airlock, you all start moving toward a curved board, placed equidistant from each of the entrances. After scrutinizing the writings on it for a few seconds, one of the Remnant exclaims, "A map!" Dusk starts discussing something with the rest of his team, but from your position you can't see what they're signing.`
			choice
				`	(Wait for them to finish their discussion.)`
				`	(Move closer to try to follow the conversation.)`
				`	(Try to get Dusk's attention.)`
			`	Dusk turns around to you. "So, <first>," he asks, "what do you think? This is indeed a map of the Builder complex. The team and I have split the exploration in four groups - one going to the armory, one visiting the underground facilities and another visiting someplace that roughly translates to 'part cycler.' If you want to come with me, we can choose between the general storage area and what seem to be some kind of elevated gardens. Or you could remain here to keep an eye on the laser scanner if you wish; the choice is yours."`
			choice
				`	"Let's go to the storage."`
					goto storage
				`	"I think it is best to visit the elevated gardens."`
					goto gardens
				`	"Sorry, but the Ka'sei are too much of a danger. I will stay here."`
			`	"Alright." Dusk and the rest of the team split toward different buildings in the complex, disappearing behind large armored doors. The next hours pass slowly as you stand outside the complex, surrounded by complete silence interrupted only by short updates from those exploring the buildings. Almost four hours later, while checking the atmospheric density scanner yet again, you notice a blinking yellow light, placed near the bottom of the control panel.`
			choice
				`	(Call Dusk with the radio.)`
					goto alarm
				`	(Ignore it.)`
			`	As the time passes, the light dims and blinks slower. It takes almost half an hour, but the yellow light finally turns off entirely.`
			`	Some time later the group returns, satisfied with what they've found inside. "It was an interesting trip for sure, Captain," Dusk tells you. "Did anything of note happen out here?"`
			choice
				`	(Tell him about the light.)`
					goto explain
				`	"Not much. It was a bit boring."`
			`	"I imagine so. You would have been more helpful in the complex together with me." After picking up the scanners, you begin to pass through the airlocks, three people at a time. After a few minutes, you're all back outside the dome, ready to finally return to <planet>.`
				goto ending

			label alarm
			`	As you tell him about the blinking light, he interrupts you and announces to the rest of the group that they are leaving. "The yellow light is an indicator that the battery is running out," he explains hurriedly. "I should have checked our equipment better. Soon, the starship airlock will be unwatched." Instead of going through a single airlock, the group splits, half going into one airlock and half into another. When you're finally all outside of the dome, the tense mood dissipates.`
				goto ending

			label explain
			`	As you tell him about the blinking light, his expression changes. "You should have called me! We could have died!" He moves to the console on the laser scanner, which stays dark. "The yellow light was an indicator that the battery was running out," he says. "I should have checked our equipment better. The starship airlock may have remained unwatched for hours now. We need to leave." Instead of going through a single airlock, the group splits, half going into one airlock and half into another. When you're finally all outside of the dome, the tense mood dissipates.`

			label ending
			`	While walking back to the ship, Dusk continues talking about the mission. He explains that they found that the Patir settlement had never been visited in its history - not even by the Builders themselves. "I did not expect to find a thriving colony inside, but this is perplexing. A possible theory is that the settlement was built by the Ka'sei themselves, but the variety of designs inside and the way everything was assembled contradicts everything we know about their capabilities. Perhaps the buildings were transported here together with them - or perhaps even the entire asteroid was brought here from a Graveyard system, though that seems unlikely. There is a lot we still have to learn about Patir."`
			`	Once you're back inside the <ship>, the team moves to their rooms to continue discussing theories about the Builder settlement here. Next destination: <planet>.`
				accept

			label storage
			`	Dusk takes the lead, and you reach a large building on the opposite side of the dome. The towering cubical structure has multiple doors on the sides, each of them taller than the one before; its walls are light, of a pale blue, with gold and brown finishes around the signs scattered across the area. Dusk stops in front of one of the smallest doors, only a few centimeters taller than you, and starts pushing it to the side to make it slide. Slowly but surely, it starts to move. Dusk enters first, and you follow.`
			`	If the depot seemed large from the outside, it's even more impressive seen from the inside; massive, sturdy shelves tower left and right, surrounded by odd machinery and cylindrical containers. While you're still studying the structure, Dusk calls you over. "Look here, <first>," he says, indicating the lower shelves in front of him. "What do you see?" It isn't easy to inspect the shelves with just your helmet lights, but you notice they're all empty. "This is not what I would expect from a settlement that used to be inhabited."`
			choice
				`	"What do you think happened here?"`
					goto theory
				`	"Maybe the rest of the depot will have something."`
					goto samples
				`	"Is it possible that they just emptied the storage when they left?"`
			`	"Maybe. But look at how pristine this place is. There is no dirt or dust anywhere I can see, and everything seems to be exactly where it should. It seems more as if it was never inhabited in the first place. There are far too many unknowns about Patir and this settlement to be certain of anything, though." He pulls another instrument from a waist pouch, then begins gathering samples from around the depot, both from the ground and on the shelves. The procedure takes a few minutes; he then puts the samples in one of the cylinders on his back and starts moving to the next room, signing for you to follow him.`
				goto depot

			label theory
			`	"At first I thought they abandoned this place and took everything with them, but look: there is no dirt or dust anywhere I can see, and everything seems to be exactly where it should. It seems more as if it was never inhabited in the first place. There are far too many unknowns about Patir and this settlement to be certain of anything, though." He pulls another instrument from a waist pouch, then begins gathering samples from around the depot, both from the ground and on the shelves. The procedure takes a few minutes; he then puts them in one of the cylinders on his back and starts moving to the next room, signing for you to follow him.`
				goto depot

			label samples
			`	"Maybe, but I would not get my hopes up if I were you." Sitting down, Dusk takes out of his waist pouch a slim, organic-looking instrument, connected with a cable to a larger box still inside the bag. He takes samples from everywhere in the room: the shelves, the door, the walls, even some from the floor. After enclosing everything inside cylindrical containers, he tells you to get ready to move to another compartment.`
			label depot
			`	You follow Dusk around the building, but the results are the same. The depot is full of empty, untouched containers and barren racks in an incredible state of preservation. After Dusk gathers the last samples, you follow him outside, where you join the other teams leaving the building with their samples. Next stop: <planet>.`
				accept

			label gardens
			action
				"patir: builder seeds" ++
			`	"I agree, it feels the most interesting of the two." The two of you follow the route indicated on the map for a while before reaching the entrance: a slender, sturdy-looking pillar roughly two meters wide with a circular opening on one side. Moving closer you can see the end of a shallow ramp right beyond the door, swirling upwards inside of the column and likely reaching the top of the dome.`
			`	"If this is supposed to be the exit of the garden," Dusk says, "I fail to see where the entrance should be. We are going to have to walk up it instead."`
			choice
				`	"Alright, let's go."`
					goto ramp
				`	"I would rather keep searching for the entrance."`
			`	You and Dusk keep walking around the structure for almost half an hour to no avail; with no other choices left but going up the ramp, you give up and decide to follow it up the pillar. Going through it is simpler than it looked, as the surface of the floor is ribbed in a peculiar way so that gripping onto it becomes rather effortless. Despite this, it takes half an hour to reach the garden, and the roof of the dome still lies well above.`
				goto top

			label ramp
			`	You follow Dusk up along the ramp, the length of it making the ascent quite tiresome. Luckily, going through it is simple, as the surface of the floor is ribbed in a peculiar way so that gripping onto it becomes rather effortless. Even so, though the garden is nowhere near the top of the dome, it takes another half an hour to reach it.`
			label top
			`	The view at the top is disappointing. In front of you, there are only rows upon rows of long racks with a dry, light gray material on the top and bottom of each shelf. Interspersed between the rows there is some Builder equipment, in which you only recognize large unlit lamps connected to the rest of the structure. Despite all of this, there are no plants anywhere, as far as the eye can see. "I believe we have stumbled upon some kind of hydroponics facility," Dusk says. "I think I have mistranslated the label on the map; this is more like a field than a simple garden."`
			choice
				`	"What is the plan now?"`
					goto plan
				`	"Why are there no plants growing?"`
			`	"It has probably been around a hundred thousand years since the last time a sapient being was anywhere near this structure. If we were on an Earth-like planet, the plants would have completely covered any artificial structure, but here on an asteroid in the middle of nowhere? Whatever water supply this place had likely ran out when the Builders were still alive." After stopping to think for a few seconds, Dusk continues.`
			label plan
			`	"Even if there are no plants, there must be containers with seeds and fertilizers somewhere around here. We have already wasted a lot of time coming up here; if you go look for those while I gather samples from the abandoned hydroponics, we will cover more terrain in the time we have left." As Dusk begins to prepare the sampling vials and the rest of the equipment, you walk toward the back of the "fields." You enter a series of tall rooms parallel to the hydroponics, none of which contain anything of note - all except the last room, which contains numerous hexagonal containers stacked on top of each other.`
			choice
				`	(Call Dusk.)`
					goto call
				`	(Open one of the boxes.)`
			`	You take one of the boxes from the top of the stack. It seems very heavy for its size, but with the help of the almost negligible gravity of the asteroid, you eventually succeed in taking it down to the floor. Opening it is even harder, as the box seems to have been sealed shut hermetically. After a lot of struggle, it opens to reveal a mass of spherical, light blue seeds tightly packed together.`
			`	Dusk reaches you shortly thereafter, but he doesn't seem too happy. "I have few pressurized containers with me, <first>. We cannot expose the seeds to the vacuum of space without the risk of killing them, and we are going to need as many chances as possible to make something grow." Taking another box from the stack, he continues, "We ought to leave this one here for a future expedition and grab another one instead."`
				goto continue

			label call
			`	It doesn't take long for Dusk to reach you. "Great find, <first>." After glancing at boxes on various piles, he finally settles for one on the top of a nearby stack and brings it down. "From the labels on its back, it seems to contain three different kinds of seeds."`
			label continue
			`	As you awkwardly scoot down the slide with the seeds, the same corrugated texture that made it possible to climb now working against you, Dusk continues his explanation. "It seems odd how none of the boxes you found were empty, or even unsealed. The hydroponics fields were in a similar situation; you would expect to find at least traces indicating the place used to be full of plants, but there was nothing of that sort. I am starting to believe this place was never inhabited in the first place, but assembling this facility would go far beyond the known capabilities of the Ka'sei."`
			`	Shortly after reaching the end, you meet up with the rest of the team, who all describe situations similar to the one you found. It takes a while to reach your ship outside the dome, but finally everything is ready to return to Remnant space. Next stop: <planet>.`
				accept
	on visit
		dialog phrase "generic cargo and passenger on visit"
	on complete
		payment 50000
		conversation
			`After disembarking from the <ship>, you help the Remnant carry out what they found in the Builder settlement. The other teams gathered a lot of artifacts during the trip, from oddly shaped vials to tall pieces of alien machinery; you help Dusk carry a small crate, containing a dozen or so cylindrical objects roughly as large as your hand behind a transparent lid. "Thank you for your help, Captain."`
			choice
				`	"What is the next move?"`
					goto next
				`	"What is in that crate?"`
			`	"Oh, these? They are a Builder sidearm - a weapon capable of emitting short-ranged electrical bursts strong enough to incapacitate or kill your target. We discovered a few hundred of them inside some bunkers in the Graveyard long ago. If you would like, I would not mind misplacing one, as a token of thanks for all your help here."`
			scene "outfit/ka'het taser"
			choice
				`	"Thank you. How do I use it?"`
					goto outfit
				`	"I'd rather be paid in credits instead."`
			`	"Oh, I have already transferred 50,000 credits to your account. I need to organize some things for our next mission; if you meet me in the spaceport a few hours from now, I should have everything ready."`
				decline

			label outfit
			action
				outfit "Ka'het Electric Stunner" 1
			`	Dusk quickly explains how to use the Ka'het weapon; its short cylindrical shape is evidently not made for human hands and proves to be quite hard to use, but you eventually figure out how to hold it while still being able to readily press the trigger. While they may not be the best weapon to capture an enemy ship, they're surely going to be very handy from a defensive position inside your own.`
			label next
			`	"Now that we know how to safely access the site, I am going to need to organize our next mission. If you meet me in the spaceport a few hours from now I should have everything ready. In the meanwhile, make sure to prepare a large enough freighter for takeoff - chances are we will need at least a hundred tons of free space in the cargo hold for the complete payload."`

mission "Ka'het: Patir Mystery 8A"
	name "Take the lab"
	description "Take the ground lab (weighing 97 tons) from <destination> to prepare for the next expedition."
	source "Aventine"
	destination "Babiali"
	passengers 5
	blocked `Dusk contacts you soon after you reach the spaceport. "<first>, we will need at least five free bunks for the mission we are preparing."`
	to offer
		has "Ka'het: Patir Mystery 7: done"
	on offer
		conversation
			`It doesn't take long for you to see Dusk; he's waiting for you under a canopy next to your landing pad, right at the edge of Aventine's starport. "We are almost ready to go," he says, "but I have run into a problem. My plan for our next mission was to have a repeat of the last expedition, but this time carrying a temporary laboratory to the Builder site. I was able to gather most of the instruments I was looking for in the local scientific facilities, but none of the mobile laboratories I am authorized to requisition by default were in good enough condition to fly.`
			`	"Because of that, before we can start our mission, we will need to make a stopover at <destination> - I was able to convince the prefects on Viminal to reallocate one of the outposts that they had just delivered there to our mission, given it has higher priority than the mining expeditions they are setting up. After outfitting it with our research equipment, it has reached a mass of 97 tons."`
			`	You help Dusk transport the chosen instruments to your ship; you also make sure to leave enough space for the facilities you're going to take from <planet>. As you're walking back to the ship's controls, Dusk reminds you to bring as many ramscoops with you as possible - you're going to need them in order to complete the mission plan while cloaked.`
				accept
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		dialog
			`Dusk's coordinates indicate the border of a large canyon near the equator of <planet>. Unlike most cracks on the surface, this one shows signs of geological activity: you only narrowly avoid a stream ejecting from a geyser in the canyon as you pass overhead. As you land, a row of Remnant structures are clearly visible running parallel to the cliff.`
			`	The local crew assist in loading the modular laboratory split across three pallets; with them arrives a separate package, containing a surveillance satellite to be deployed near Patir while cloaked.`
	on abort
		clear "remnant: dusk busy"
	on fail
		clear "remnant: dusk busy"


mission "Ka'het: Patir Mystery 8B"
	landing
	name "Lab deployment"
	description "Reach <system> and land while still cloaked in order to set up the Remnant laboratory."
	source "Babiali"
	destination "Builder Settlement"
	passengers 5
	cargo "research lab and satellite" 97
	blocked `Dusk contacts you soon after you reach the spaceport. "<first>, this mission is going to require <capacity>."`
	to offer
		has "Ka'het: Patir Mystery 8A: done"
	on enter Patir
		dialog
			`The probe slowly moves away from your ship, opening its external panels and the instrumentation; as you watch it turn into a dim point of light, the Remnant team confirms that it is functioning correctly. Time to land on the asteroid.`
	on abort
		clear "remnant: dusk busy"
	on fail
		clear "remnant: dusk busy"
		dialog
			`You have approached the Builder Settlement uncloaked, making the Ka'sei follow you, or the escort that was carrying the Remnant scientists has been destroyed, or the escort that was carrying the mission cargo was destroyed. You have failed this mission.`
	on visit
		dialog `You have reached <planet>, but not all of the cargo and passengers are in the system! Better depart and wait for your escorts to arrive in this star system. Remember that your escorts need to be cloaked as well. You may want to park your escorts that are incapable of cloaking.`
	npc save
		government "Test Dummy"
		personality unconstrained heroic nemesis
		system "Patir"
		fleet
			variant
				"Cloak Check" 10


# Invisible ship in Lathia, represents the power of the asteroid base in the system

mission "Asteroid guarding Lathia"
	invisible
	landing
	to offer
		has "Ka'het: Patir Mystery 8B: offered"
	to complete
		never
	npc save
		government "Magic Asteroid"
		personality forbearing frugal heroic staying vindictive
		system Lathia
		ship "Asteroid Planet" "Queen Asteroid"

ship "Asteroid Planet"
	attributes
		category "Heavy Warship"
		"uncapturable" 1
		"inscrutable" 1
		"cost" 158000000
		"hull" 86135672193
		"required crew" 1
		"bunks" 1
		"mass" 67400
		"drag" 3040
		"heat dissipation" 10
		"energy capacity" 1
		"fuel generation" 0.3
		"cargo space" 40
		"outfit space" 390
		"weapon capacity" 150
		"engine capacity" 95
		"hull repair rate" 47
		"cargo scan power" 1
		"cargo scan efficiency" 0.001
		"thrust" 34020
		"turn" 593140
		"asteroid mount jd" 1
		"asteroid mount am" 1
		"asteroid mount" 1
		weapon
			"blast radius" 80
			"shield damage" 800
			"hull damage" 400
			"hit force" 1200
	outfits
		"Asteroid Weapon Super"

	gun 0 0 "Asteroid Weapon Super"

outfit "Asteroid Weapon Super"
	"display name" "???"
	category "Guns"
	cost 1861000000
	thumbnail "outfit/unknown"
	mass 1
	"outfit space" -1
	"weapon capacity" -1
	"gun ports" -1
	weapon
		"submunition" "asteroid fragment" 180
		"inaccuracy" 1
		"velocity" 70
		"lifetime" 2
		"reload" 360
		"safe"
		"split range" 300
		"blast radius" 400

outfit "asteroid fragment"
	weapon
		"submunition" "spin1 print right"
		"submunition" "spin1 print left"
		"inaccuracy" 360
		"velocity" -65
		"random velocity" 20
		"lifetime" 40
		"random lifetime" 80
		"hull damage" 50
		"heat damage" 800
		"ion damage" 3
		"safe"
		"hit force" 100
		"blast radius" 200


mission "Ka'het: Patir Mystery 9"
	landing
	name "Explore the neighborhood"
	description "Visit every system around <system> you can reach, then return to Dusk."
	source "Builder Settlement"
	waypoint "Athiri"
	waypoint "Chanai"
	waypoint "Ghila"
	waypoint "Lathia"
	waypoint "Maithi"
	waypoint "Mitera"
	waypoint "Sarifa"
	waypoint "Thepa"
	waypoint "Balnii"
	to offer
		has "Ka'het: Patir Mystery 8B: done"
	on offer
		event "Patir spaceport" 0
		conversation
			`Approaching the settlement from the northeast, you park the <ship> once again next to the airlock array; it's almost starting to become a familiar sight by now. With the cargo ramp pointed toward the entrance and the post-flight checklist completed, the Remnant team begins to deploy the lab while you remain in the cockpit, keeping an eye on Ka'sei activity. The researchers work quickly and nearly without issue in the light gravity of the asteroid, besides the occasional lost screw. However, the construction job still takes nearly the entire day.`
			`	With the Ka'sei still oblivious, and the lab set up, you take advantage of the opportunity to stretch your legs and pay a visit to the researchers in the new outpost. "So, Captain," asks Dusk, meeting you at the entrance, "what do you think of it?"`
			scene "scene/lab scene"
			choice
				`	"It is beautiful."`
					goto beautiful
				`	"Well, it seems rather functional."`
					goto functional
				`	"That is all?"`
			`	"Admittedly, the research-focused part in it is rather limited - it is a repurposed mining hub, after all - but it should comfortably house a few people for as long as needed. Besides," he adds, "there is all the space you could ask for to stretch your legs inside the dome."`
				goto tour

			label functional
			`	"Hopefully! It is a repurposed mining hub, after all, so its capabilities will be quite limited as a laboratory, but it should comfortably house a few people for as long as needed. Besides," he adds, "there is all the space you could ask for to stretch your legs inside the dome."`
				goto tour
			label beautiful
			`	He smiles. "It has a certain charm for sure. As a repurposed mining hub, its capabilities will be quite limited for a laboratory, but it should comfortably house a few people for as long as needed. Besides," he adds, "there is all the space you could ask for to stretch your legs inside the dome."`
			label tour
			`	You step inside the lab's internal door, removing your helmet now that the atmosphere is breathable. Dusk takes you around the cylindrical hub to show the various sections of it: the sleeping quarters, small but not cramped; the extravehicular research module, a flexible corridor connecting it with the airlock and housing spacesuits with rather unwieldy instruments, and so on. As the tour comes to an end, you and Dusk return to the entrance, where the rest of the team is split between checking the expedition's equipment and preparing something to eat. "We are about to dine now," Dusk mentions. "There is an extra seat in case you would like to join us."`
			choice
				`	"I would be happy to."`
					goto dinner
				`	"What comes next?"`
					goto next
				`	"If that is all, I'd rather move back to my ship to prepare for liftoff."`
			`	"Alright, Captain," Dusk replies. "I will contact you when we need a ride back. Our current plan is to remain at the outpost for one or two months, exploring the Builder settlement and studying everything it has to offer. Do not go too far, though - emergencies can always happen, after all."`
				goto decline

			label dinner
			`	Lacking a true dining room, the meal has been set up on a table between the bunks of the researchers. It takes a few tries to find a position in which everyone is at least somewhat comfortable and the dinner can finally begin. You notice that the portions of the rather unappealing Remnant food are much smaller than what you're used to seeing them eat - similar to yours, in fact. One of the researchers notices you looking at her plate, and replies, "I assume you have been told about the symbionts and their increased nutritional needs by now? The four of us have been selected for the mission in part because of the fact that we are part of the small number of scientists that do not wear one, which makes us better suited for expeditions with limited supplies."`
			choice
				`	"What is your reason for not having a symbiont?"`
					goto reason
				`	"Do you have a symbiont, Dusk?"`
					goto dusksymbiont
				`	(Just finish the dinner and leave.)`
			`	The rest of the dinner passes rather quickly, and within half an hour you're ready to return to your ship. At the entrance, Dusk approaches you.`
				goto next
			label dusksymbiont
			`	"I do have one - right under the cervical vertebrae, at the top of my back. Being the lead researcher of this mission, there was not much choice left; removing it at this point wasn't an acceptable option, and switching positions this late into the program would have been much more harmful than increasing the reserves planned to the right level." As the dinner comes to an end, you and Dusk move back near the entrance.`
				goto next

			label reason
			`	"For me, the reason is medical. My body rejected the symbiont quite violently shortly after the initial operation, to the point that even attempting to install another would be very risky. But if you ask around, the causes are quite varied." As the dinner comes to an end, you and Dusk move back near the entrance.`
			label next
			`	"Our current plan is to remain at the outpost for one or two months, exploring the Builder settlement and studying everything it has to offer. Do not go too far in the meanwhile, though - emergencies can always happen, and you are supposed to be our ride back when the time comes." He pauses for a few seconds to think. "If you are interested, perhaps you could remain here with us to help with the research. You would need to sleep in your starship, of course, and the supplies would be slightly more limited, but neither issue is a showstopper. It is up to you, <first>."`
			choice
				`	(Accept the offer.)`
				`	(Decline the offer.)`
					goto decline
			`	"Perfect then," Dusk replies. "See you tomorrow!" You move back aboard your ship and walk up to the bunks to prepare for the night; however, you notice out of a window that the full Remnant team has come out of the lab, staring up at the sky. You attempt to contact them, but the only result is an eerie quiet. All of a sudden, you realize what is wrong: the starry night is gone, and a sky of an overwhelming black now surrounds everything and everyone.`
				goto sky

			label decline
			`	"I understand. See you in a few weeks then, Captain, and may the Embers guide you." You move back aboard your ship and walk up to the cockpit to prepare for liftoff; however, you notice out of the corner of your eye that the full Remnant team has donned their spacesuits, and is standing outside the lab. For a split second you think that they've come outside to watch the liftoff, but they aren't looking at your ship; they're staring up, at the sky. You attempt to contact them, but the only result is an eerie quiet. All of a sudden, you realize what is wrong: the starry night is gone, and a sky of an overwhelming black now surrounds everything and everyone.`
			label sky
			`	As your eyes adapt to a featureless sky, you notice brief, nearly imperceptible white streaks passing past your field of view in an instant. The lines become more and more visible, almost like stars during a hyperjump, when your attention is captured by a white mass slightly above the horizon. It starts as a tiny dot in the distance, then becomes bigger and bigger, until it covers the entire sky. The extreme light it produces forces you to look away for a second, and when you look back, there are even more streaks in the sky, to the point of making you feel nauseous.`
			`	You can't tell how much time has passed since the phenomenon began, but it finally starts to show signs that it's coming to an end: the streaks become shorter and last longer in the sky, and the number of stars you can see becomes less and less. You begin noticing more and more details; some streaks seem to end before reaching the horizon, while others follow a curved or even cyclical pattern around Patir. Eventually, the stars come to a standstill, and everything returns to normal.`
			`	Still dizzy from the experience, you carefully walk back down outside to speak with the Remnant. By the time you've reached them, they seem to have recomposed themselves and have started studying some sort of holographic stellar map.`
			action
				event "Patir moves" 0
			choice
				`	"What was that?"`
					goto what
				`	"Is everyone okay?"`
			`	"We are all shaken by the experience, but we have much bigger problems to think about now," Dusk replies. "Something is not right with the sky."`
				goto constellation
			label what
			`	"I wish I knew. And the worst may have yet to come," Dusk replies. "Something is not right with the sky."`
			label constellation
			`	He points at the projector. "Do you see those two triangular formations near the top of the star map? That is something we called the Ember Prism - a constellation of six stars of similar magnitude, located far from the Wastes and close to each other. While it is not visible from Earth, it should be recognizable from almost every system here, including Patir, but no longer. And that is not all. None of the constellations in this star map can be found anywhere in the sky." He stops for a second, giving a worried look to the rest of the team. "We are no longer in the Ember Wastes."`
			choice
				`	"How is that possible?"`
				`	"Where are we then?"`
				`	"How do we get back?"`
				`	"Was that a hyperspace jump then?"`
			`	"I have no idea, <first>. What I can tell you for now is that we need to get a clearer idea of what we have around before deciding the next step, and there is no way to get that from here. You need to explore as far as possible in this new sector, and return once you either find a way out or run out of systems. I promise we will have a plan ready by the time you're back."`
				accept
	on enter Chanai
		dialog
			`As soon as you enter Chanai, your sensors detect a massive structure of artificial nature, apparently a station of some kind.`
	on enter Athiri
		dialog
			`As you enter the system, your sensors lose any trace of the wormhole you passed from. There doesn't seem to be a way to pass through it again from this end.`
	on visit
		dialog
			`Observing the systems you have mapped, Dusk seems disappointed. "There must be a way to reach the other systems. Please look everywhere you can for a passage; there has to be something."`


event "Patir moves"
	system Patir
		pos 10059.5 10.5
		remove haze
		set "ka'het: beyond Patir"

event "Patir spaceport"
	planet "Builder Settlement"
		spaceport `The Remnant laboratory merges oddly well with the rest of the environment, similar in color and design to the Builder structures around here. The spaceport consists only of a flat strip of regolith near the settlement, hastily cleaned of the debris that covers most of the terrain.`


mission "Ka'het: Patir Mystery 10"
	landing
	name "Gather data"
	description "Board the Remnant satellite in orbit around <system> to learn more about the odd creatures around here."
	passengers 1
	source "Builder Settlement"
	blocked `Right as you touch down, you notice a message coming in from Dusk. "<first>, we will need at least a free bunk for the mission we are preparing."`
	to offer
		has "Ka'het: Patir Mystery 9: done"
	on offer
		conversation
			`By the time you land, the Remnant are already discussing their analysis of the data recorded and transmitted by your ship. When they notice you, they abandon their current conversation and move closer to speak with you in person.`
			`	They listen carefully as you detail your journey: the Ghila ringworld, the one-way wormholes, the Chanai station, and the many oddities in each of these systems. From the questions they ask you, they seem to be particularly interested about the asteroid-looking creatures roaming this sector. By the time you've finished recounting the last events, almost an hour has passed.`
			`	"Interesting," Dusk signs in response. "It is disappointing to hear that there is not a clear way out, but everything else here is intriguing - perhaps one of them is the key to finding a passage back. Our attempts at communicating with the Ember Waste have been unsuccessful; I fear we will have to be completely on our own this time."`
			choice
				`	"Have you identified anything of note here?"`
				`	"Do you have a plan?"`
					goto plan
				`	"Did you find out what this place is?"`
			`	"Unfortunately, you seem to have learned a lot more than we did staying here in Patir. We do not have enough information to say anything beyond that we are not in the Milky Way anymore. We were able to re-enter the settlement and access the computers that control the structure, but unfortunately a lot of them are malfunctioning or broken. From what we were able to gather, they seem to be entirely unaware of what has happened.`
				goto lab

			label plan
			`	"For now, only vague ideas. I was hoping we could determine a clear, identifiable origin of our accidental jump, but we have nothing of that sort for now. While you were away, we were able to re-enter the settlement and access the computers that control the structure, but unfortunately a lot of them are malfunctioning or broken. From what we were able to gather, they seem to be entirely unaware of what has happened.`
			label lab
			`	"The time spent inside the lab was more productive. After a few days, one of the creatures you have encountered jumped in - and a few minutes after, every Fetri'sei around us went dormant. They stopped their engines, ceased mining and just drifted without any sign of life. But as soon as the creature left the system, they returned to their normal activities as if nothing happened.`
			`	"Going forward, we need to determine a list of possible causes for the event that brought us here, and investigate the most likely one. If we dock to the satellite we launched at the beginning of this mission and recover everything it recorded during the encounter, it could help us understand them better than we can from the ground.`
			`	"Besides that, we have also confirmed you no longer need to cloak when landing here; when you approach the lab with your ship, you are too far away from the settlement for the Ka'sei to understand that you are coming to visit it, as long as we explore the Builder base only when your spaceship isn't landed here. It should save you some fuel, hopefully. Any questions?"`
			choice
				`	"No, I am ready to go."`
					accept
				`	"I think it would be quicker if we went straight to the station."`
			`	"Maybe, but that might be an unnecessary risk. First things first, <first>; there is no need to rush anything."`
				accept

	npc assist save
		system "Patir"
		government "Remnant"
		personality derelict mute pacifist target
		ship "Remnant Satellite" "Bright Ember Yonder"
		dialog `From the open cargo bay, you watch as the satellite moves up inside your ship. You split up tasks between yourself and Dusk, keeping the satellite stabilized while he downloads the data. In a few minutes the process is over, and you can return the probe to its original mission.`
	
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		conversation
			`Walking down your ship's stairway, Dusk thanks you again for your help. You hand him a datapad with the information gathered, as well as the equipment he brought with him to pick up the satellite's signal.`
			`	"I will join the rest of the team to start analysis," he signs in response. "We have a lot of data to examine, and not much time. Meet us in the lab in a few hours."`


ship "Remnant Satellite"
	sprite "ship/remnant satellite"
	attributes
		category "Drone"
		hull 130
		mass 10
		drag 2
		"heat dissipation" 1
	explode "tiny explosion" 5
	explode "small explosion" 2


mission "Ka'het: Patir Mystery 11"
	name "Gather more data"
	description "Visit <waypoints>'s neutron star to study the mysterious creatures living around it."
	source "Builder Settlement"
	waypoint "Lathia"
	to offer
		has "Ka'het: Patir Mystery 10: done"
	on offer
		conversation
			`Compared to its cleanliness at the start of the mission, the lab is in chaos: pieces of Remnant devices and Builder objects lie all over the floor and tables, leaving only a small footpath to connect the various sections. The team is gathered on the opposite end of the building, discussing the results of the mission with disappointed expressions.`
			`	"Bad news, Captain," Dusk says, turning to you. "Both our ground scanners and the orbiting satellite recorded the same amount of information about these beings: nothing at all. For the entire duration of the encounter, the only information gathered on them was their position. Something in their construction makes it impossible to infer anything about their internal structure.`
			`	"If we do not find a way to learn more about them, we have few options left, and all rather dangerous."`
			choice
				`	"Do you have any ideas?"`
				`	"Well, there's still other places we could visit."`
			`	"We are evaluating our options. The Ghila ringworld is too large and distant; the risk of an accident overshadows the possibility of discovering anything useful. On the other hand, the station in Chanai is very close to where Patir is now - a couple jumps, both ways.`
			`	"However, there are downsides. Exploring it would mean exposing ourselves to any device or trap inside the station; our explorations of Builder stations back in the Graveyard have had body counts." Dusk stops for a few seconds, immersed into his thoughts. "For now, boarding the station is too much of a risk."`
			`	After searching a large bag on the ground, one of the Remnant brings out another holographic projector. She tinkers with it for a bit until it focuses on the neutron star you visited earlier, Lathia. "This is our safest bet at learning more about these creatures," she signs. "According to your data, this system has by far the highest number and diversity of them. If you pass through the system while cloaked and use our sensors, you may be able to obtain enough information without putting yourself at risk."`
			choice
				`	"If those scanners did not work on them here, why would it be different in Lathia?"`
					goto why
				`	"What if I run out of fuel?"`
					goto fuel
				`	"What happens if this fails as well?"`
			`	"That is a distinct possibility," Dusk replies, "but we must investigate every avenue before we resort to risking personnel."`
				goto assembly

			label fuel
			`	"It will only take a few minutes to determine whether our equipment can see through the exterior of these beings," Dusk replies. "I suggest filling your fuel tanks near Patir before leaving."`
				goto assembly
			label why
			`	"It is a shot in the dark," Dusk replies. "Being able to scan even just one of these beings would be a great leap forward - perhaps one without external shielding, or damaged in such a way that permits us to analyze them."`
			label assembly
			`	The Remnant begin to mount and wire all the scanning equipment on the <ship>. After a few hours, you're ready to take off once again.`
				accept
	on enter Lathia
		dialog
			`A dull hum from below the cockpit signals that the scanners have activated. You take the opportunity to observe the mesmerizing colors of the neutron star, beautiful and terrifying at the same time. After a few minutes, a beeping sound alerts you that the scan is complete, and you can return to <system>.`
	on visit
		dialog `You have returned to <planet>, but you haven't visited <waypoints> yet! Better depart and make sure you visit the system.`
	npc
		government "Magic Asteroid"
		system "Lathia"
		personality plunders harvests surveillance mute waiting staying
		fleet
			cargo 3
			variant
				"Asteroid Large 4"
				"Asteroid Medium"
				"Asteroid Young 2"
				"Asteroid Young 1"


mission "Ka'het: Patir Mystery 12.1A"
	landing
	name "The <system> station"
	description "Investigate the station in <system> for a way to return to the Milky Way with the five Remnant scientists."
	passengers 5
	source "Builder Settlement"
	destination "Chanai Structure"
	blocked `Right as you touch down, you notice a message coming in from Dusk. "<first>, we will need at least five free bunks for the mission we are preparing."`
	to offer
		has "Ka'het: Patir Mystery 11: done"
	on offer
		conversation
			`The Remnant are already standing outside the lab, waiting for your arrival. Dusk meets you in the cockpit right as you've finished safing your ship.`
			`	"It does not look promising, <first>. Just as with the satellite, nothing beyond basic orbital information was recorded by the scanners we gave you. Maybe we could understand something about these beings after in-depth analysis, but nothing that could help us in our search.`
			`	"One of the few discoveries we could make is the existence of a particular asteroid around Lathia - on an order of magnitude larger than the rest of the fleet, but still belonging to the same species. It appears to be completely still, unlike its kin, and does not show any external activity; this might make it fit for a surface expedition, but doing that on what appears to be a living being is nevertheless extremely dangerous.`
			`	"Still, our options are limited. I have mentioned previously the possibility of exploring the station in Chanai; it would definitely be risky, but it may be something we are unable to avoid if no safer alternative can be found. While you were away, however, part of the team developed a second mission plan. We came to the realization that if these beings can stop the Fetri'sei, there must be some sort of connection between them. If we could somehow intercept this link, it would let us study more than our sensors could, and perhaps even communicate with them."`
			choice
				`	"How do you propose to do that?"`
					goto how
				`	"Can you do that from here?"`
			`	"Unfortunately, that goes far beyond our area of expertise," Dusk replies, "if it is even possible in the first place. It would be more feasible to connect to this signal physically. We know that the Ka'sei will remain dormant for the entire time the being remains in this system. If the <ship> was close enough to a Fetri'sei when the being arrives, we would have around half an hour to access its internal computer and connect to its communication system. However, this exposes us to significant danger if the being leaves the system prematurely, or if accessing the Fetri'sei reactivates it.`
				goto choose

			label how
			`	"In our opinion," Dusk replies, "connecting to it physically seems like the most feasible option we have. We know that the Ka'sei will remain dormant for the entire time the being remains in this system. If the <ship> was close enough to a Fetri'sei when the being arrives, we would have around half an hour to access its internal computer and connect to its communication system. However, this exposes us to significant danger if the being leaves the system prematurely, or if accessing the Fetri'sei reactivates it.`
			label choose
			`	"Even still, we believe this approach is safer than exploring Chanai. You have seen what happened the first time we tried to explore Patir; the structures in this part of space are guarded by lethal force. In contrast, if our new plan goes south, we will at least be able to quickly return to the lab. Of course, it may be that neither of these options will help us escape," he adds, somewhat frustrated. "The team is at a standstill, with both options having more cons than pros. The choice is yours, Captain."`
			choice
				`	"Chanai seems to be a better option."`
					goto chanai
				`	"The new plan feels more viable to me."`
					goto hack
				`	"Which option do you prefer?"`
			`	"I do not want to influence you in making this choice, <first>. Both options are more dangerous than I am comfortable with, but there is little we can do about that now. It is up to you now."`
			choice
				`	"Chanai seems to be a better option."`
					goto chanai
				`	"The new plan feels more viable to me."`
			label hack
			`	"Alright then. The first step will be deploying some satellites in the nearby systems. To maximize the amount of time we have, we will need preemptive warning on the arrival of these beings. Reusing the sensors we put on your ship and coupling them with the spare parts we have in storage should be enough to assemble a few probes; meet us in the lab in a few hours and we will be ready."`
				decline

			label chanai
			`	"Okay then. Most of the equipment we are going to need is the same equipment we used for Patir, so we will be ready to depart in just half an hour." After helping them pack the last few items, you take off and set the course to the new destination: <system>.`
				launch
	on enter Chanai
		dialog
			`The gargantuan station still sits far away from you, appearing as just a dot in the distance. A long range scan of the structure reveals enough of it for an initial assessment; after a quick discussion, the Remnant pick out an approach vector for you.`
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		conversation
			`The external coating of the structure appears pristine and untouched, much like a new spaceship. Orbiting far above a black hole, next to no asteroid moves in an orbit capable of posing a threat to it. Next to you, one of the Remnant researchers points a bulky scanner toward the station; after a few minutes, she indicates a place from which the structure can be accessed.`
			`	"This is going to be a little different compared to our previous expeditions in Patir, <first>," Dusk remarks while walking toward the ship's airlock. "We cannot even fathom who built this place, let alone understand how to access their systems and control their doors. We will have to use a little more brute force here to move inside the complex." As he says this, he gestures towards the blowtorch-like piece of equipment on his back.`
			`	With the <ship> stationed about a meter away from the structure, the entire team slowly moves out of the airlock with you. Still tethered to the ship for safety, the Remnant swiftly prepare the boarding equipment for the mission, attaching it to the platform in a matter of minutes. "In order to access this module, we are about to melt through its hull," Dusk announces. "Are you ready?"`
			choice
				`	"Of course."`
					goto melting
				`	"Are you sure this is safe?"`
			`	"As far as we can tell. The module is fully depressurized, and it seems to be completely inert from our scans - there are always uncertainties, of course, but this is the most easily accessible spot we could identify in the little time we had."`
			label melting
			`	A bright flash begins the boarding operations; one of the Remnant, handling the same torch you had seen earlier, slowly cuts a roughly circular hole into the module's whipple shield until it comes off handily. Moving the debris away, the process is then soon repeated with the next layer and again with one right after; the strong vibrations it imparts into the rest of the structure give you a clear hint about the power of this device. Eventually, the innermost layer is removed as well, and you follow the rest of the team inside the alien platform.`
			`	Disconnecting from the tether to move further into the opening, you immediately notice the module seems to have some peculiarities. Despite the microgravity in it, no handrails can be found near you, making movement very difficult; as you search for some inside with your flashlight, however, your attention is caught by something more bizarre: an ominous, featureless blob, hovering midair a few meters away from you.`
			`	The object's surface, only interrupted by a few cyclical ripples, reflects and eerily distorts everything around the room. A complete silence has fallen over the room, as everyone seems to evaluate the situation. After a few seconds, Dusk and two Remnant start moving toward the phenomenon carrying a device in their hands.`
			choice
				`	"What is that thing?"`
					goto thing
				`	(Wait and see what happens.)`
					goto thing
				`	(Raise your blaster.)`
			`	Noticing your reaction, Dusk gestures you to stop. "Calm down, Captain," he signs, "a handgun would be of little use in this situation." Keeping an eye on the data the other scientists are gathering, he continues. "We seem to have entered the station from one of the fuel tanks. That sphere over there is made of some kind of propellant, though our instruments have some difficulties determining its exact composition.`
				goto continue

			label thing
			`	"Interesting," Dusk states, as if immersed in his thoughts. After checking that the device has started gathering data, he continues. "We seem to have entered the station from one of the fuel tanks. That sphere over there is made of some kind of propellant, though our instruments have some difficulties determining its exact composition. It must have an incredibly low vapor pressure to remain liquid in this near vacuum.`
			label continue
			`	"All I can say for certain is that it is not the hyperdrive fuel we use - liquid deuterium would have boiled off long ago. Luckily, we don't need to know what it is; there should be enough space to pass through without touching it." Scouting around the tank for a passage, the team quickly identifies a maintenance hatch, hopefully leading to the crew section, and starts creating another hole to pass through. The whole process is slightly quicker than the first was, but by the time they're done more than a third of the oxygen reserves in your suit are gone.`
			`	Moving through the opening, you reach a long, cylindrical corridor, just as dark as the room you just came from. Based on the many handles and scaffolding attached to the surfaces around you, you guess this part of the station used to be inhabited. After following the group through the tunnel for a few minutes, you reach an intersection: the corridor splits into two lateral openings, each of them seemingly as small and endless as the one you're in.`
			`	"We only have a limited amount of time for this expedition, <first>. You have seen us work a few times now; can you explore the two tunnels on your own and reach us when you have completed it?" Dusk asks. "We will remain in radio contact the entire time."`
			choice
				`	(Accept.)`
					goto tunnel
				`	"Do you have any information about this section?"`
				`	"Why are you not going to help explore these tunnels?"`
					goto help
			`	"Not much. We only had time for a brief scan during the approach, but based on the volume of these sectors alone, it shouldn't take you more than a couple hours to explore them.`
				goto tunnel
			label help
			`	"Well, we have our own tunnels to go through," he replies half-seriously. "We have a lot of ground to cover, and only so much air in our suits. The safest way to increase our reach without staying here for weeks is by splitting up, like we did when we first explored the Builder settlement a few weeks ago.`
			label tunnel
			`	"Whenever you reach a new area, take samples and pictures of anything you deem interesting. Never forget to keep an eye on your oxygen: each of us will consume it at slightly different rates, and we should start the trip back as soon as someone has less than a third of a tank left. May the Embers help your search, Captain, and see you soon!"`
			`	Moving in the zero gravity station is quick and relatively easy; despite its length, it only takes you a few minutes to reach the end of the right tunnel. All you can find, however, is a closed hatch. A few tries at forcing it open only serve to confirm that it is locked shut, and you decide to go back and try the other tunnel. This time, your search turns up results, and you end up in a dark, somewhat cramped room.`
			`	The room is lavish and dazzling, the walls covered with intricate carvings. It's a striking difference from the gray and slightly coarse material everywhere else in the station, pushing you to gather a few samples to analyze later. To an extent, it reminds you of the Art Deco paintings of ancient humanity. Around the room, alien plants of varying height and shape paint every corner with a reddish hue.`
			choice
				`	(Quickly take a sample and move on with your mission.)`
					goto moving
				`	(Leave them alone.)`
					goto moving
				`	(Inspect them closer.)`
			`	Growing from the vase up to almost the ceiling, the plant you choose to analyze stands at nearly twice your height; despite this, the trunk is only a few millimeters thick, thanks to the lack of gravity aboard the station. Slender, needle-like leaves are spread across the entire stem, contrasting its okra with a red tint.`
			`	As you try to take a better look at the fronds, the entire trunk breaks in half with minimal pressure. You try to pick up the upper segment before it flies away, but this only splits it into more parts; you decide to observe the resulting pieces from afar instead. To your surprise, the plant is completely hollow, with a large hole inside the stem. You take a few pictures and a couple samples of both the surface and of the vase, then move to the next room.`
			label moving
			`	The rest of the zone isn't as interesting. A series of holes in a wall attract your attention, but they prove too narrow to pass through and too long to see the end; similarly, the corridor at the end of the area is slightly smaller than your suit, preventing you from continuing. As you return back to the rest of the group, however, you notice an unusual drawing.`
			`	The canvas, attached between various carvings, shows a series of points in a line with every color of the rainbow. While the lines are near the bottom of the mural, above them all shines what looks like a red sun, sending rays of light down to each of the colorful dots and surrounding them all in a crimson halo. You pass your glove over its surface, and you notice every part is composed of a different material, smoother and more refined than the walls around it.`
			`	While the oxygen levels in your suit continue to lower, you follow Dusk's instructions from the radio up and down the maze of tunnels until reaching a large open area where you finally find the Remnant, busy observing a vial of samples. Behind them, you see the start of the giant barrel that composes most of the station's structure.`
			choice
				`	"What is this place?"`
					goto place
				`	"What is inside the vial?"`
					goto vial
				`	(Move closer to the barrel.)`
			`	The sheer size of the frame is rather impressive: as you walk toward it, you estimate it must be at least a kilometer from one side to the opposite. At the very end, an enormous lens is attached to the last ring of the barrel; four holes near its center give it a slight resemblance to a cloth button.`
			label place
			`	"We are most likely in the exhaust chamber of this station's laser system," Dusk says, putting the vial inside a container. "It is impossible to say for certain what its purpose was - hopefully, it was not purely a military system. That being said, we have obtained some info that is far more relevant for our search. Let us get going toward the <ship> first, then I will show you everything we have gathered."`
				goto back

			label vial
			`	"Our ticket back, hopefully," Dusk replies with a half smile. "While everything we have seen is interesting in its own way, there is something in particular that gives me hope about finding a way out. But first, we need to start moving back now - we have spent enough time studying this exhaust chamber, and our oxygen margins are starting to worry me."`
			label back
			`	One at a time, the group enters back into the main tunnel, with Dusk at the rear and you right in front of him. You notice the passage at the end doesn't show any blowtorch marks; it seems that the Remnant found it already open when they arrived here.`
			`	"While you were exploring that sector, we found a few more tunnels and split up into subgroups to explore each of them. This is how we found the path to the barrel, for instance, as well as many other peculiar areas. And, in one of them," he continues, clumsily passing you a data pad, "this is what we stumbled upon."`
			`	Looking at the screen, you see a photograph of two Remnant standing in front of a large mural, three times as tall as them and far wider. Despite the picture being rather poorly lit, you recognize it as a two-dimensional starmap, carved into the wall of the station. Near the bottom right, a set of circles and unfamiliar markers surround one of the systems indicated.`
			`	"Look at the orbital parameters of that system. It is, without a shadow of doubt, indicating Patir. A system they should not be aware of, if it only just arrived here, but it is one they were apparently interested in."`
			choice
				`	"It could be a coincidence."`
					goto coincidence
				`	"Perhaps Patir used to stay here before reaching the Milky Way."`
					goto milky
				`	"For what purpose?"`
			`	"I would also like to know that. I cannot recognize the language in the text, and deciphering it would be an enormous task - one that would require a vast amount of text to analyze, as well as years of focused effort from the whole community. We must base our decisions only on what we can infer from the graphic itself, which is far from ideal. And then, there is this."`
				goto crystal
			label milky
			`	"You may be right. I cannot recognize the language in the text, and deciphering it would be an enormous task - one that would require a vast amount of text to analyze, as well as years of focused effort from the whole community. We must base our decisions only on what we can infer from the graphic itself, which is far from ideal. And then, there is this."`
				goto crystal
			label coincidence
			`	"Maybe. Without reading the text surrounding it, which is written neither in Builder nor any language I can recognize, we can only analyze what we can infer from the graphic itself - something far from ideal. But if we take it at face value, it could be the first step towards escape from this sector. And then, there is this."`
			label crystal
			`	Dusk hands you the vial from earlier, which, despite its size, feels rather heavy in your hand. Inside is a grainy dust interspersed with small, violet crystals of various shapes. "We found a similar powder on the ground of a number of rooms inside the station. We have not explored the entire complex, of course, but if the pattern repeats we expect there to be something similar around the entire barrel."`
			`	The particles suspended in the vial remind you of the regolith surrounding the Builder settlement orbiting Patir, but far less compact. "Attempts to learn the dust's composition have been inconclusive. Perhaps the instruments in the lab will give us better results, but our current tools only returned noise. However, we did notice something potentially interesting: the noise aligned with the scans you took in Lathia a few days ago. Whatever it is, it could be made of the same matter that composes those creatures - I can use the scanners on your ship to confirm it without wasting any time while we depart."`
			`	You exit the station and enter your ship, and see most of the scientists have already moved their samples inside your cargo hold, with around two dozen containers scattered on the floor. Soon after, you're back inside the cockpit, preparing for liftoff; discussion about the next mission will have to wait until you're in Patir.`

mission "Ka'het: Patir Mystery 12.1B"
	landing
	name "Return to <system>"
	description "Return to the <destination> to figure out the next step."
	passengers 5
	source "Chanai Structure"
	destination "Builder Settlement"
	blocked `Right as you touch down, you notice a message coming in from Dusk. "<first>, we will need at least five free bunks for the mission we are preparing."`
	to offer
		has "Ka'het: Patir Mystery 12.1A: done"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		conversation
			`As you accompany the Remnant team back to the lab, they confirm Dusk's theories on the dust. From the way they speak about it, they seem to have reached a consensus on the source of the regolith, though they don't go into details.`
			`	The module was never particularly inviting, but over the last few weeks, a thin layer of dust coming from outside the asteroid has covered the floor, with just the surfaces needed for the research kept clean. Tiredness plagues the faces of the scientists: they must not have slept much in the past days to keep up with the amount of incoming data, and neither have you. As you try to remember the last time you stepped outside without a suit - at least a month, most likely - your thoughts are interrupted by the arrival of Dusk, carrying on his back the last few samples.`
			choice
				`	"Sounds like this expedition was more productive than the last."`
				`	"Now that this is done, what are you going for next?"`
					goto next
			`	"Oh, definitely! While the data we could gather was not as much as I hoped, we now have a rather clear connection between Patir and Chanai, as well as between the station and those peculiar beings. That, alone, is invaluable for our mission.`
			label next
			`	"During the trip back, we evaluated the options at our disposal. As you may guess, the most obvious one would be to explore further into the station; however, it was not as attractive as previously thought. While it may have been used to influence Patir, it is clear that it now sits silent and powerless, as if missing something that can bring it back to life. We could find more about its design, perhaps, but the chances of using it on our own within a reasonable time scale are low.`
			`	"We have enough consumables to last for many weeks still; we started rationing as soon as we arrived in this sector, and we are prepared to reduce them further if necessary. Nevertheless, we need to take a more direct approach if we want results. Approaching the species that inhabits this cluster is essential at this point, and doing so as soon as possible would be advisable."`
			choice
				`	"What do you suggest?"`
					goto plan
				`	"Are you proposing a first contact of some sort?"`
					goto contact
				`	"Are they behind the Chanai station?"`
			`	"Maybe, maybe not. The internal design of the station is an odd fit for the asteroids' size and characteristics, but we do know for certain they have been there in the past, and you have seen for yourself how difficult it is to find a way in.`
				goto plan

			label contact
			`	"In a way. We have been considering a close approach to one of those beings ever since we first saw them, and your discovery of the planetoid in Lathia opens up the opportunity for a surface expedition - gathering samples, analyzing its reaction, and perhaps yes, if they are intelligent and the conditions are right, a true first contact between our two species could happen.`
				goto lab
			label plan
			`	"We have been considering a close approach to one of those beings ever since we first saw them, and your discovery of the planetoid in Lathia opens up the possibility for a surface expedition. Thanks to its size, landing with the <ship> should be possible, and we could even explore the planetoid in our suits if the surface is safe. Perhaps, if these beings are truly intelligent, this could be the first contact between our two species.`
			label lab
			`	"Meet us in the lab in a few hours, and we will have everything ready for the trip. With a bit of luck, most of the instruments we used on Chanai will be a good fit for this mission as well."`
		
mission "Ka'het: Patir Mystery 12.2A"
	name "Satellite deployment"
	description "Deploy two probes in <waypoints> to keep an eye on incoming space rocks."
	source "Builder Settlement"
	passengers 5
	cargo "Remnant Probes" 3
	waypoint "Mitera"
	waypoint "Thepa"
	blocked `Right as you touch down, you notice a message coming in from Dusk. "<first>, we will need at least five free bunks and 3 tons of cargo for the mission we are preparing."`
	to offer
		has "Ka'het: Patir Mystery 11: done"
		( "Ka'het: Patir Mystery 12.1A: offered" + "Ka'het: Patir Mystery 12.1A: declined" ) % 2 == 0
	to accept
		has "Ka'het: Patir Mystery 12.1A: declined"
	on offer
		conversation
			`You find the team waiting for you in the lab. Next to them are two mechanical crates, roughly the size of a person. Most of the clutter around the room has been cut down considerably; these satellites alone must have used the larger part of their reserves. "Here they are, Captain," Dusk states proudly. "Two autonomous surveillance probes, capable of scanning an entire system without any input and slowly beaming the results back to us. Their capabilities are far from what our main fleet is capable of back home, but, considering our situation, they should be more than enough.`
			`	"We have settled on their destinations: the stellar black holes of <waypoints>. Once there, they will be far enough to give us appropriate warning, but close enough to only pick up asteroids heading towards Patir. If they do, that will be our signal to depart and intercept them right as they come in."`
			choice
				`	"Understood."`
					accept
				`	"Is there a specific orbit I should deploy these probes in?"`
			`	"Oh, there is no need to worry about that. Their scanners are easily powerful enough to cover the whole system. Their power and communication capabilities are far more limited, but for the time we need them to last, this should not be an issue. Bring me to those systems, and I will handle the rest."`
				accept
	on enter "Mitera"
		dialog
			`As the satellite leaves your ship, you watch it move further away and unfurl its solar arrays. The probe quickly disappears in the blackness of space.`
	on enter "Thepa"
		dialog
			`Dusk quickly reaches for the console, initiating the satellite deployment procedure you've become accustomed to. It doesn't take long for it to complete, and in a few minutes you're ready to leave the system once again.`
	on visit
		dialog phrase "generic missing waypoint or cargo and passengers"

ship "Asteroid Blocker"
	attributes
		"heat dissipation" 1
		"hull" 3
		"mass" 100
		"drag" 5
		"automaton" 1
		"thrust" 100
		"turn" 6000
	outfits
		"Fuel Removal"
	turret 0 0

outfit "Fuel Removal"
	category "Turret"
	thumbnail "outfit/unknown"
	"turret mounts" -1
	weapon
		"velocity" 1000
		"lifetime" 10
		"reload" 100000
		"blast radius" 200000
		"safe"
		"no damage scaling"
		"range override" 10000000
		"homing" 4
		"tracking" 1
		"acceleration" 1.5
		"drag" 0.2
		"turn" 12
		"fuel damage" 500
		"turret turn" 360

mission "Ka'het: Patir Mystery 12.2B"
	landing
	name "Ka'sei hacking"
	description "Taking advantage of the arrival of one of the asteroids, dock with a disabled Ka'sei to gather data from its internal computers."
	passengers 5
	cargo "Ka'het boarding payload" 3
	source "Builder Settlement"
	to offer
		has "Ka'het: Patir Mystery 12.2A: done"
	on offer
		event "no Patir spaceport and no Fetri spawn" 0
		conversation
			`Dusk seems busier than usual as you descend towards the settlement, constantly communicating with the team on the ground while simultaneously checking the incoming telemetry. When you're hovering right above the landing pad, he turns to your console. "Keep the thrusters in standby, Captain," he signs hastily. "We are not here to stay. The satellites are working very well; in fact, the Thepa probe has just detected one of those beings jumping right in our direction. We have only a few hours to return to orbit, or we will waste this opportunity."`
			`	On the ground, the whole team rushes out of your ship toward the lab, soon returning with their hands full of strange equipment and unwieldy machinery. You quickly prepare your ship's cargo bay for the new payloads and walk down to Dusk so you can help them carry the instruments aboard. "The approaching asteroid is of the small or medium kind, as far as I can tell. Considering your past interactions, or lack thereof, it is unlikely to cause any issue."`
			`	"What should I do once in orbit?" you ask.`
			`	"First, we will verify that all identifiable Ka'sei have entered a dormant state after the creature's arrival. Once that is confirmed, you will rendezvous with one of the deactivated Fetri'sei so that we can spacewalk to it. We will handle the rest from there.`
			`	"Of course, this will be the first time in Remnant history that one of us boards a Ka'sei; after all, it wasn't too long ago we learned of their existence. But we have explored many kinds of Ka'het over the years with varying results, and with that experience I am confident we should be able to complete our mission."`
			choice
				`	"Are you sure this will be safe?"`
				`	"Let's go then."`
					goto depart
			`	"Trust me, <first>," Dusk replies, "it will be incredibly risky. None of us would be doing this if we could say for certain there was a better way, but here we are. Help me with this crate now; we are almost ready to go."`
			label depart
			`	As the last container is brought inside, the cargo ramp moves back, and the exit door follows suit. Glancing at the scanner telemetry, you realize the alien being has already started to exit hyperspace; with a button press, the engines roar back to life, and the ship starts gaining altitude.`
				launch
	on enter
		event "Patir spaceport returns and Fetri spawn" 1
	npc assist
		government "Ka'sei (12.2)"
		personality derelict harvests mining plunders uninterested waiting
		fleet
			names "ka'sei"
			cargo 3
			variant
				"Fetri'sei (Patir 12.2)"
		conversation
			`The giant creature floats a few meters away from your cockpit, silent and motionless, but you know that inside the shell, the slug remains alive and well, ready to kill. Compared to some of the Ka'het back in the Graveyard, this is one of the Builders' smaller creations, but its size is still impressive for what is, in essence, a single organism.`
			`	Before setting the <flagship> to automatic station-keeping, you move your ship so that the main hatch is as close as possible to the Fetri'sei. The Remnant are already in the airlock donning their extravehicular suits, and you join them shortly after.`
			`	"When we are inside, there is a high probability we will not be able to communicate," advises Dusk. "Normally, the walls of the armored shell are too thick and dense for our signals to pass through, and the spaces we need to navigate prevent us from using a physical tether. This does not mean we will be unprotected, however. May I see your sidearm?"`
			`	You draw your weapon out of the holster and hand it to him. After a quick examination, he nods and gives it back before continuing. "Once inside, one of our first operations will be connecting to the downlink of the Fetri's telemetry: it is not protected, in our experience, and it is easy to access. From there, we will be able to monitor the vessel's shields.`
			`	"Many things could go wrong during this mission: the unknown creature could leave the system early, or maybe we could inadvertently awaken the Ka'sei with our actions. If you notice anything out of the ordinary, no matter how minor, take out this gun, point at an empty spot on the shell, and shoot. Our terminals will let us know even the smallest variation in its shield integrity, and we will run back to safety as soon as this happens."`
			choice
				`	"Will this not anger the Ka'sei?"`
					goto anger
				`	"What if you cannot access the shield levels?"`
			`	"Then we will abandon the mission. Without that safety net, it would be too dangerous to continue. However, since they were both created by the Builders, it should be similar enough to the Ka'het design language.`
				goto move

			label anger
			`	"Almost certainly not, given how negligible the damage should be. A sidearm would not make a scratch in its armor, let alone a dent; and even in the small chance it does activate its defenses, you should have enough time to leave the system and let it calm down.`
			label move
			`	"Inside, we will search for the memory banks of the spacecraft. After a quick selection based on the data we can scrape, we will take the few that contain information concerning our research and extract their contents. Understood?"`
			choice
				`	(Nod.)`
					goto entrance
				`	"What about me?"`
			`	"Given that you need to be able to fire as quick as possible, you cannot return to the cockpit. So, we took the liberty of creating a small terminal here to keep an eye on the situation." He points to a small desk in the cargo bay filled to the brim with Remnant machinery.`
			label entrance
			`	One by one, the scientists jump from your ship to the Fetri, moving toward a closed, circular hatch in between the two engines. As you watch them start the expedition, you sit down at the makeshift console, monitoring movements in the system as well as any changes to the slug. Though you can't clearly see what they are doing, you distinguish someone inserting a rod inside a small aperture, followed by the hatch opening right after.`
			`	As the crew moves beyond your line of sight and communications cease, your unease grows steadily. You split your attention between the various screens in front of you and glancing out of the airlock. The clock on your suit's wrist keeps on ticking slowly.`
			`	Scanning over the monitors for the umpteenth time, you see that heightened energy levels have been detected inside the unknown creature.`
			choice
				`	(Wait and see what happens.)`
					goto waiting
				`	(Shoot the Fetri'sei with my sidearm.)`
			`	You take the weapon from the table and shoot the Fetri'sei just as the creature covers itself in rose-tinted sparks. According to Dusk, one shot should be enough to send the message through the impenetrable armor of the spacecraft, but nothing seems to happen after your gun's energy bolt disperses on the surface of the ship.`
				goto fired
			label waiting
			`	A second later, the creature covers itself in a burst of rose-colored sparks: it's about to jump away! You take the weapon from the table and pull the trigger, releasing a bolt of energy that quickly disperses on the surface of the Fetri'sei. According to Dusk's words, it should be enough to send the message through the impenetrable armor of the spacecraft, but nothing seems to happen after the shot.`
			label fired
			`	Second after second passes relentlessly, with no reaction whatsoever from the Fetri'sei or its surroundings. As the unknown creature fades behind a violet cloud and jumps away, you can't help but wonder what to do.`
			choice
				`	(Shoot the Fetri'sei a second time.)`
					goto shoot
				`	(Keep waiting.)`
					goto wait
				`	(Jump on the Ka'sei to call the Remnant aboard.)`
			`	There's no time to waste. Without hesitation, you push yourself off the border of the airlock and toward the Fetri'sei. After remaining airborne for a few instants, you land right next to the leftmost engine nacelle, bouncing off its skin. A timely activation of the thrusters on your wrists helps you move back to its surface, however, and by grabbing a long spike attached to its back, you can finally stabilize and move further ahead.`
			`	White noise starts coming from your communicator; moving your head up, you finally see the Remnant leaping out of the hatch, carrying a dozen faintly glowing cylindrical tubes under their arms. They notice you right when communication returns to normal, and their message arrives loud and clear: "Jump!"`
			`	You leave the handles and use your feet to give you a good push away from the spacecraft. At the last second, you move to the right to avoid ending up behind one of its thrusters just as they roar to life. The Fetri'sei has awakened, and for an instant you see all of its systems activate at once - the engines, the steering, even the Ravagers.`
				goto return

			label shoot
			`	You press the trigger once more, and the projectile again dissolves in the shield protecting the back of the Fetri'sei. For a few seconds still nothing seems to happen, but then, slowly, white noise starts coming from the communicator. Watching the spacecraft, you finally see the Remnant leaping out of the hatch, carrying a dozen faintly glowing cylindrical tubes under their arms.`
				goto continue
			label wait
			`	The wait is excruciating, but after a few seconds, you start hearing white noise coming from your headphones. Right as you start recognizing some words, one of the Remnant leaps out of the hatch, followed closely by the other four. Under their arms, you can distinguish a dozen cylindrical tubes, a faint glow surrounding them.`
			label continue
			`	A flashing warning appears on the console: the energy readings of the other spacecraft are rising quickly. Right as you try to warn the rest of the group, the Ka'sei comes back to life, and for an instant you see all of its systems returning online at once - the engines, the steering, even the Ravagers.`
			label return
			`	Amidst the chaos, you count that all five of them made it out of the hatch, still carrying some of the cylinders with them. They were able to leave before the spacecraft's thrusters started firing, and they seem to have remained relatively unharmed by the event. The Ka'sei moves further and further away.`
			`	One at a time, they move back into the airlock, leaving their cargo attached to one of the instruments they carried with them. As you close the door and pressurize the compartment, Dusk approaches you about the mission.`
			`	"Thank you for that, <first>. We had to cut short the exploration when we saw your message, before we had the chance to retrieve the specific data we were looking for. As a compromise, we decided to take some memory banks - these cylinders - with us, so we could search through the data later. It was dangerous, but it worked.`
			`	"That said, I suggest returning to the outpost as soon as possible. The Ka'sei we have boarded may start acting erratically after this, or it may even attack us; we have removed part of its brain, after all. Hopefully this mission will not backfire against us."`
			`	You sit back in the cockpit, starting the engines once again.`
	on visit
		dialog phrase "generic cargo and passenger on visit"
	on complete
		fail "Ka'het: Patir Mystery 12.2C"

# The mission here is a complex mashup of game functions that uses many different mechanics to achieve the intended sequence:
# - two ships spawn, one disabled and one functional (but otherwise standing still);
# - the player boards the disabled ship, with the mission happening before their eyes;
# - the other ships jump away right after the mission, and the one the player boarded returns to its normal functions.
# In order to achieve this, the asteroid ship has just over 200 fuel and a negative fuel generation, meaning that it will be unable to jump essentially right after it spawns; removing the spaceport means that it won't be able to refuel on the Builder settlement, and so it remains in space doing nothing but waiting. When the player boards the disabled NPC, it is repaired and returns to its functions; as it is an enemy of the asteroid ship, it will shoot it with every available weapon, including what has been hidden under "Ka'het Machinery": a negative fuel damage weapon, that will instantly refill its fuel reserves and let it jump. Giving it just a capacity of 200 would mean that the game would always think it is just infinitesimally under the threshold to jump, so I gave it 250 and everything works as it should with surprising consistency. Two peculiarities of this are that the player will be able to board the asteroid ship to refuel it, and that the Ka'sei could shoot the asteroid with its ravagers for a split second before it jumps if the position of the two is just right. Both of them are harmless: the health of the asteroid is orders of magnitude higher than the damage the Ka'sei can inflict in that time, and as the player boarding the asteroid will give it exactly 200 fuel because of game mechanics, 1 single frame later it will be already unable to jump. However, in order to account for their oddity I added a small dialog to the asteroid's boarding screen to make it as if you were flying by it, and described at the end of the previous mission how for an instant the Ravagers ignite when the Ka'sei returns online, as if in an unintended burst.

event "no Patir spaceport and no Fetri spawn"
	system Patir
		remove fleet "Ka'sei"
	planet "Builder Settlement"
		remove spaceport

event "Patir spaceport returns and Fetri spawn"
	system Patir
		add fleet "Ka'sei" 300
	planet "Builder Settlement"
		spaceport `The Remnant laboratory merges oddly well with the rest of the environment, similar in color and design to the Builder structures around here. The spaceport amounts to only a flat strip of regolith near the settlement, hastily cleaned of the debris that covers most of the terrain.`


mission "Ka'het: Patir Mystery 12.2C"
	landing
	invisible
	source "Builder Settlement"
	to offer
		has "Ka'het: Patir Mystery 12.2A: done"
	npc assist
		government "Magic Asteroid"
		personality coward fleeing harvests pacifist uninterested waiting mute
		fleet
			cargo 3
			variant
				"Asteroid Large (Patir 12.2)"
		dialog
			`The giant creature stands before you, slowly pulsating in a pale pink halo. The bubbles that interrupt the asteroid-like surface are slightly semitransparent, giving you a brief look at the crystalline structure inside, but your mind soon returns to your time-limited mission, and you decide to move ahead before it's too late.`
	to fail
		has "Ka'het: Patir Mystery 12.2B: done"


outfit "Ka'het Machinery"
	category "Turrets"
	thumbnail "outfit/unknown"
	"turret mounts" -1
	"unplunderable" 1
	weapon
		"velocity" 1000
		"lifetime" 1
		"reload" 1
		"blast radius" 100000
		"safe"
		"no damage scaling"
		"range override" 1000000
		"homing" 4
		"tracking" 1
		"acceleration" 1.5
		"drag" 0.2
		"turn" 12
		"fuel damage" -400
		"turret turn" 360

ship "Fetri'sei" "Fetri'sei (Patir 12.2)"
	plural "Fetri'seia"
	sprite "ship/fetri'sei"
	thumbnail "thumbnail/fetri'sei"
	attributes
		category "Interceptor"
		"cost" 5700000
		"shields" 2400
		"hull" 7200
		"required crew" 1
		"bunks" 1
		"mass" 210
		"drag" 2.9
		"heat dissipation" .5
		"fuel capacity" 100
		"self destruct" 1
		"ramscoop" 0.13
		"cargo space" 62
		"outfit space" 383
		"weapon capacity" 184
		"engine capacity" 86
		"energy capacity" 10000
		"energy generation" 23.3
		"heat generation" 32
		"shield heat" 3.4
		"hull repair rate" 0.3
		"ka'sei" 1
		weapon
			"blast radius" 120
			"shield damage" 540
			"hull damage" 280
			"hit force" 780
	outfits
		"Ka'het Machinery"
		"Ka'het Ravager Beam" 2

		"Ka'het Primary Cooling"
		"Ka'het Shield Restorer"
		"Ka'het MHD Generator"
		"Ka'het Reserve Accumulator"

		"Ka'het Compact Engine" 2

	gun -13 -36
	gun 13 -36
	turret 0 0
	engine -20 46.5
	engine 20 46.5
	explode "tiny explosion" 6
	explode "small explosion" 10
	explode "medium explosion" 18
	explode "large explosion" 10
	"final explode" "final explosion small"
	description "The Fetri is a self replicating probe, built to harvest iridium away from the Graveyard and transport it back to the Builders."

ship "Asteroid Large 1" "Asteroid Large (Patir 12.2)"
	sprite "ship/asteroid adult"
	attributes
		category "Transport"
		"cost" 1350000000
		"hull" 965612
		"required crew" 1
		"bunks" 1
		"mass" 130
		"drag" 4.1
		"heat dissipation" .7
		"energy capacity" 1000
		"energy generation" 10
		"fuel capacity" 250
		"fuel generation" -1
		"cargo space" 50
		"outfit space" 390
		"weapon capacity" 150
		"engine capacity" 95
		weapon
			"blast radius" 80
			"shield damage" 800
			"hull damage" 400
			"hit force" 1200
	outfits
		"Asteroid Anti-Missile"

		"Asteroid Jump Drive"
		
	engine 0 0
		zoom 1
		angle 0
		over
	turret 0 0 "Asteroid Anti-Missile"
	explode "tiny explosion" 10
	explode "small explosion" 25
	explode "medium explosion" 25
	explode "large explosion" 10
	"final explode" "final explosion medium"


mission "Ka'het: Patir Mystery 13.1"
	name "Return to <planet>"
	description "Now that the Patir black hole appears to have returned to the Milky Way, return to <planet> together with Dusk."
	passengers 5
	source "Builder Settlement"
	destination "Aventine"
	to offer
		has "Ka'het: Patir Mystery 12.1B: done"
	on offer
		event "Patir returns" 0
		conversation
			`The time has come: the walk toward the lab is quick and straightforward, and you cover the whole distance in a matter of minutes. Peeking through the hatch's window, you see the rest of the group preparing their backpacks, with prepacked toolboxes surrounding them in every direction. You wave through the glass, and they return the greeting.`
			`	You move the airlock's heavy door to pass through, and wait for the room to be re-pressurized before walking in. By the time the hatch unlocks, however, the Remnant are gone, hastily leaving their bags on the floor.`
			`	As you take a few steps inside the lab, you turn around to find them all glued to the windows with an awestruck gaze. The sky has again turned black, and a few dim lines are already starting to appear in the distance.`
			`	While stars and galaxies zoom in the night sky, a few of the Remnant run around the lab, turning on various instruments. However, most of them remain with their faces stuck to the glass. The lights start converging toward a single point, forming a large, but rapidly shrinking mass in the background.`
			`	The stars begin to slow down before settling into their final positions. After all the time you have spent here, it isn't difficult to recognize that the sky has changed again. Next to you, the rest of the team is already analyzing the data gathered; Dusk seems to be writing down something from a chronometer.`
			choice
				`	"Are we back in the Milky Way?"`
				`	"How long was that?"`
					goto time
				`	"Where are we now?"`
			`	"I cannot say yet," Dusk replies hurriedly. "Quick, put your EVA suit back on. We need to depart as soon as possible, all of us together. I do not know how much time we have." You hastily connect your helmet back to the life support and follow them out of the airlock, trying to keep up as best as you can.`
				goto depart

			label time
			`	"Around four minutes," Dusk replies hurriedly. "But we will talk about that another time. We need to depart as soon as possible, all of us together. I do not know how much time we have." You hastily connect your helmet back to the life support and follow them out of the airlock, trying to keep up as best as you can.`
			label depart
			`	It takes only a few minutes to launch the <ship>, the six of you standing in the cockpit with trepidation. "We will take care of the necessary analysis while you bring us to orbit. Hopefully we have been sent to the Milky Way, and not to yet another unreachable galaxy."`
				launch
	on enter
		conversation "end of Patir 2 - on enter"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment 1570000
		clear "remnant: dusk busy"
		set "initial patir exploration"
		event "patir mystery 2 timer" 45
		conversation "end of Patir 2 - on complete"

mission "Ka'het: Patir Mystery 13.2"
	landing
	name "Return to <planet>"
	description "Now that the Patir black hole appears to have returned to the Milky Way, return to <planet> together with Dusk."
	passengers 5
	source "Builder Settlement"
	destination "Aventine"
	to offer
		has "Ka'het: Patir Mystery 12.2B: done"
	on offer
		conversation
			`Back down on the surface, you complete the post-landing checklist while keeping an eye on the movements of the Ka'sei. The research station has been a safe place to retreat during past expeditions, but it seems doubtful that it could last against a prolonged attack from one of the Fetri'sei.`
			`	When the scientists finish unloading their cargo, Dusk calls you with the communicator. Now that the immediate danger is over, a hint of frustration creeps into his voice.`
			`	"The cells we have taken from the Fetri are only a few out of multiple hundreds. We did our best to choose those that were recorded at times when those beings were present, but we will still need some luck to get the results we wanted.`
			`	"Our calculators have been crunching numbers for hours now, ever since we cracked open the first canister. By the time you have reached the lab, we should have the analysis ready." You close the hatch behind you to join the rest of the crew.`
			`	As the asteroid continues its nearly imperceptible spin, Patir emerges from behind the giant dome, allowing its rays to pass through. You take the last steps towards the outpost with the sunshade lowered and walk into the lab once more.`
			`	The module was never particularly inviting, but over the last few weeks, a thin layer of dust coming from outside the asteroid has covered the floor, with just the surfaces needed for the research kept clean. Tiredness plagues the faces of the scientists: they must not have slept much in the past days to keep up with the amount of incoming data, and neither have you. As you try to remember the last time you stepped outside without a suit - at least a month, most likely - your stream of thoughts is interrupted by the arrival of Dusk, carrying in his hands a ream of papers.`
			`	"The information in the memory containers is indeed from when one of those beings was in the system, and the data recorded was far more comprehensive than our own scans. However, the memory containers we extracted only contain records from the middle of the phenomenon, without showing how it begun or ended. Additionally, understanding their contents is going to take longer than we hoped for. We knew that the exact relationship between the being and the Fetri'sei would be beyond our knowledge, but we cannot even make preliminary guesses as to how they are able to communicate.`
			`	"We have enough consumables to last for many weeks still; we started rationing as soon as we arrived in this sector, and we are prepared to reduce them further if necessary. Despite this, the time and manpower needed to crack this code would go far beyond what we could feasibly achieve. We have hit a roadblock that, for now, we cannot overcome."`
			choice
				`	"Does this mean we need to repeat the mission?"`
				`	"What are our options?"`
					goto options
			`	"We considered it briefly, but it would be quite ineffective. Our blocker is understanding the data itself, and having even more would do little to help us with that. On top of that, the risk would be extremely high, as we have seen. All things considered, we are at the same point we were a week ago.`
			label options
			`	"We are left with few alternatives. As I told you previously, the Chanai station is an interesting possibility, and could have influenced Patir's erratic behavior. At the same time, exploring the asteroid around Lathia may put us closer to understanding the inner workings of the beings and how they interact with the Ka'sei. It is quite dangerous, but visiting the space station is also an unknown, and maybe a more direct approach is what we need to accomplish our objective. Neither mission prevails over the other in a definite way, and our votes within the team are split evenly between the two, so if y-"`
			`	Dusk halts mid phrase, looking behind you with an awestruck gaze. The sky has again turned black, and a few dim lines are already starting to appear in the distance. The whole team jumps to the windows, watching as the light show begins.`
			`	While stars and galaxies zoom in the night sky, two Remnant keep running around the lab, turning on various instruments. However, the rest of them remain with their faces stuck to the glass with you. The lights start converging toward a single point, forming a large, but rapidly shrinking mass in the background.`
			`	The stars begin to slow down before settling into their final positions. After all the time you have spent here, it isn't difficult to recognize that the sky has changed again. Next to you, the rest of the team is already analyzing the data gathered; Dusk seems to be writing down something from a chronometer.`
			action
				event "Patir returns" 0
			choice
				`	"Are we back in the Milky Way?"`
				`	"How long was that?"`
					goto time
				`	"Where are we now?"`
			`	"I cannot say yet," Dusk replies hurriedly. "Quick, put your EVA suit back on. We need to depart as soon as possible, all of us together. I do not know how much time we have." You hastily connect your helmet back to the life support and follow them out of the airlock, trying to keep up as best as you can.`
				goto depart

			label time
			`	"Around four minutes," Dusk replies hurriedly. "But we will talk about that another time. We need to depart as soon as possible, all of us together. I do not know how much time we have." You hastily connect your helmet back to the life support and follow them out of the airlock, trying to keep up as best as you can.`
			label depart
			`	It takes only a few minutes to launch the <ship>, the six of you standing in the cockpit with trepidation. "We will take care of the necessary analysis while you bring us to orbit. Hopefully we have been sent to the Milky Way, and not to yet another unreachable galaxy."`
				launch
	on enter
		conversation "end of Patir 2 - on enter"

	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment 1570000
		clear "remnant: dusk busy"
		event "patir mystery 2 timer" 45
		set "initial patir exploration"
		conversation "end of Patir 2 - on complete"

event "Patir returns"
	system Patir
		pos -38 553
		haze _menu/haze-red
		clear "ka'het: beyond Patir"


conversation "end of Patir 2 - on enter"
	`The cockpit has become quite chaotic: the instruments the team brought with them keep buzzing and beeping. After shutting down the main engines, someone taps on your shoulder to call your attention. "<first>, could you pitch the ship down a few degrees?" Dusk asks, with a calmer look than during liftoff. You reply with a nod, and move the stick forward slightly.`
	`	"There! Do you see it?" he continues, pointing at a spot in the sky with his hand. Between the mass of stars in front of you, a pattern leaps to the eye: two sets of three stars, right next to each other, forming a prism-like structure. "We are back."`


conversation "end of Patir 2 - on complete"
	`A large crowd quickly gathers around your landing pad, eagerly awaiting your arrival. After all this time between the stars, setting foot on a planet with an actual atmosphere is incredibly refreshing. Ignoring the cold weather for a moment, you take the biggest breath you can to make up for the past weeks of recycled air.`
	`	Before you've even reached the end of the ramp, the people on the ground are already signing questions to you and the rest of the team about your journey. You do your best to reply, but in the overall mix of confusion and excitement you aren't sure anyone understood what you just said.`
	`	Between the chaos, you hear a familiar voice singing your name: a few meters on your left, you notice Chilia with his arm raised and a large grin greeting you back. Moving across the crowd not without some difficulty, you follow him through a narrow door inside a cramped room right next to the pad.`
	`	"I prefer this spaceport when it is more hushed," he remarks with a sigh, "but after the past weeks some frenzy is understandable. We will have to make do with this warehouse for now." He invites you to take a seat. "So, <first>, would you tell me about your journey?"`
	`	By the time you're done, more than an hour must have passed. Chilia paces aimlessly around the room, reflecting on your recounting of the events. As silence falls, you notice that calm seems to have returned on the pad as well.`
	choice
		`	(Wait for him to speak.)`
			goto wait
		`	"Do you know how we came back to this galaxy?"`
		`	"What happened while we were gone?"`
	`	"Oh. I thought you had been told already." He sits down in front of you. "It was us that brought Patir back here. After your departure, it did not take long for our long-range sensors to pick up that the black hole had disappeared, along with you and the team. Our data was scarce, but we knew one, very important thing: if Patir had appeared here once, there must have been a way to do that again.`
		goto explain
	label wait
	`	"If your description is accurate, it means Patir is not another mouth to a pocket universe, but instead a transporter to another galaxy. Or universe, for all we know. In retrospect, there were enough reasons to doubt that first theory, but we were far too busy trying to save you to look into it seriously." Seeing your confused expression, he continues. "<first>, it was us who brought Patir back here.`
	label explain
	`	"We knew Postverta was involved with Patir's initial arrival, and together with the team there, we discovered that the energy burst that had been released when Ssil Vida first appeared had no relation to the systems controlling its pocket universe. So, its activation or deactivation would have no effect on Patir, and we had to start looking somewhere else.`
	`	"Our research up to this point had mostly focused on the pocket universe; most of Postverta is still obscure to us. As we evaluated our options, we determined that, by the time we could understand the station's systems enough to use them for our purposes, your crew would have already run out of supplies and perished. Instead, we attempted to replicate the energy burst using just our technology, augmented by the transmission systems of Ssil Vida.`
	`	"The project took most of our workforce, as well as several weeks to complete, no thanks to a number of setbacks almost making us start over from scratch. But with the full power of the onboard reactors and an array of calculators rivaling that of our largest outposts, its giant antennae came back to life, and released a wave as strong as when Ssil Vida appeared. Two weeks later, Patir returned, and now you are here, safe and sound."`
	`	Finally, a tired Dusk reaches the two of you in the storage room, sitting down after greeting Chilia and you. From a brief exchange between them, you infer that he has also been told of the circumstances around your return.`
	choice
		`	"What is going to happen to Patir now?"`
			goto patir
		`	"Wait, what if we were not around Patir when it came back?"`
	`	"The black hole would have departed without us, and we would have been still stuck in that sector - only this time without a laboratory to support us, nor most of our consumables. The people down here perhaps could have been able to send Patir back there to pick us up, but by then we would have run out of supplies long before, and perished between the stars. We were lucky that things went the way they did, all things considered. Our research in those systems was supposed to bring us back, and yet we were just chasing rainbows, endangering ourselves further every step we took.`
		goto next

	label patir
	`	"It is difficult to say. Given what we have observed, it will probably disappear once again after the effects of our energy burst; when that will happen or where it will go is beyond our current knowledge. Those same systems we were stuck in could now be inaccessible, and our data might be the only information we will ever gather on them.`
	label next
	`	"At this point in time, exploring Patir would be a gamble, and an extremely risky one at that. The next phase will have to be operated from a distance, in order to fully understand the way that system works and how Ssil Vida controls it. How much time that will take, I cannot say; maybe weeks, or months, or even years. But then, and only then, will we go back there and start digging deeper."`
	choice
		`	"I understand."`
			goto finish
		`	"You want to return there?!"`
	`	Dusk smiles. "It is my job, after all. The danger of the unknown is always a part of it, even in the simplest of missions. I do admit the risk in these past weeks was far beyond an acceptable level, but one day, we will know enough about the mess in which we have become tangled in to unravel it."`
	label finish
	`	The two of them accompany you to the <ship>, sitting alone in the now-quiet spaceport of <planet>. The cargo bay has been emptied of the vast array of instruments that had been lying in it for a while, and you guess the same has been done with the cockpit. As you walk once again up the stairway, the Remnant bid you farewell. "We have transferred <payment> as a way to express our gratitude," Dusk signs with a smile. "Of course, their worth is incomparable with the value of what you have done for us; without you, we would have never made it out alive. Goodbye for now, and may the Embers aid in your pursuits."`



event "patir mystery 2 timer"
